Example #1
0
// StartDepthStream begins the retrieval of depth information from the device.
func (device *Device) StartDepthStream(resolution Resolution, format DepthFormat) error {

	errCode := C.freenect_set_depth_mode(device.device,
		C.freenect_find_depth_mode(C.freenect_resolution(resolution), C.freenect_depth_format(format)))

	if errCode != 0 {
		return errors.New("could not find depth mode")
	}

	errCode = C.freenect_start_depth(device.device)

	if errCode != 0 {
		return errors.New("could not start depth stream")
	}

	return nil
}
Example #2
0
// Starts the acquisition of the depth stream. The source function will be invoked to obtain the first frame buffer.
func (camera *DepthCamera) Start() int {
	if camera.on == true {
		return 1
	}

	buffer := camera.source(camera.bytes)
	rc := int(C.freenect_set_depth_buffer(camera.device.dev, unsafe.Pointer(&buffer[0])))
	if rc != 0 {
		fmt.Printf("Failed to set depth buffer: %d\n", rc)
		return rc
	}
	camera.current = buffer

	rc = int(C.freenect_start_depth(camera.device.dev))
	if rc != 0 {
		fmt.Printf("Failed to start depth stream: %d\n", rc)
		return rc
	}

	fmt.Printf("Depth stream started\n")
	camera.on = true
	return 0
}
Example #3
0
//FREENECTAPI int freenect_start_depth(freenect_device *dev);
func (dev *Device) StartDepth() int {
	return int(C.freenect_start_depth(dev.ptr()))
}