Exemple #1
0
//export depthCallbackInterceptor
func depthCallbackInterceptor(device *C.freenect_device, depth *uint16, timestamp uint32) {

	if val, ok := devices[device]; ok && val.depthCallback != nil {
		attributes := C.freenect_get_current_depth_mode(devices[device].device)

		depthSliceData := C.GoBytes(unsafe.Pointer(depth), C.int(attributes.bytes))
		depthSlice := make([]uint16, int(attributes.width)*int(attributes.height))
		for i := 0; i < len(depthSliceData); i += 2 {
			depthSlice[i/2] = uint16(binary.LittleEndian.Uint16(depthSliceData[i : i+2]))
		}
		val.depthCallback(val, depthSlice, timestamp)
	}
}
Exemple #2
0
//FREENECTAPI freenect_frame_mode freenect_get_current_depth_mode(freenect_device *dev);
func (dev *Device) GetCurrentDepthMode() FrameMode {
	fm := C.freenect_get_current_depth_mode(dev.ptr())
	return *(*FrameMode)(unsafe.Pointer(&fm))
}