Skip to content

Instantly share code, notes, and snippets.

View masterchef8's full-sized avatar

Philippe Giraudeau masterchef8

View GitHub Profile
@katas94
katas94 / WorldSpaceUIDocument.cs
Created October 27, 2021 19:11
Custom Unity component to create a world-space UIToolkit panel
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
namespace Katas.Experimental
{
public class WorldSpaceUIDocument : MonoBehaviour, IPointerMoveHandler, IPointerUpHandler, IPointerDownHandler,
ISubmitHandler, ICancelHandler, IMoveHandler, IScrollHandler, ISelectHandler, IDeselectHandler, IDragHandler
@ttruongatl
ttruongatl / ARKit-ARFrame-Opencv.mm
Last active April 6, 2024 00:54
fix padding image
// The Y plane represents the luminance component, and the UV plane represents the Cb and Cr chroma components.
// In the case of kCVPixelFormatType_420YpCbCr8BiPlanarFullRange format, you will find the luma plane is 8bpp with the same dimensions as your video, your chroma plane will be 16bpp, but only a quarter of the size of the original video. You will have one Cb and one Cr component per pixel on this plane.
// so if your input video is 352x288, your Y plane will be 352x288 8bpp, and your CbCr 176x144 16bpp. This works out to be about the same amount of data as a 12bpp 352x288 image, half what would be required for RGB888 and still less than RGB565.
// So in the buffer, Y will look like this [YYYYY . . . ] and UV [UVUVUVUVUV . . .]
// vs RGB being, of course, [RGBRGBRGB . . . ]
// https://stackoverflow.com/questions/13429456/how-seperate-y-planar-u-planar-and-uv-planar-from-yuv-bi-planar-in-ios
#pragma ARSessionDelegate
- (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame{
CVPixelBuff
from matplotlib import pyplot as plt
import cv2
img = cv2.imread('/Users/mustafa/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
plt.title('my picture')
plt.show()
@Tantas
Tantas / SKTexture+Gradient.h
Last active July 19, 2022 09:59
Creates a SKTexture programatically with a vertical gradient.
#import <SpriteKit/SpriteKit.h>
@interface SKTexture (Gradient)
/** Creates a SKTexture programatically with a vertical gradient.
Great suggestion for colors: http://ios7colors.com/.
Example:
(Inside a SKScene class)
@sixman9
sixman9 / CMakeLists.txt
Created December 14, 2010 10:42
cmake files for Apple IOS development (has C++ lean, can be adapted however)
# See original post at http://stackoverflow.com/questions/822404/how-to-set-up-cmake-to-build-an-app-for-the-iphone
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0016 NEW)
project(test)
set(NAME test)