コード例 #1
0
ファイル: device.go プロジェクト: postfix/go-freenect
// 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
}
コード例 #2
0
ファイル: freenect.go プロジェクト: buka/go-freenect
// 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
}
コード例 #3
0
ファイル: freenect.go プロジェクト: krux02/freenect-go
//FREENECTAPI int freenect_start_depth(freenect_device *dev);
func (dev *Device) StartDepth() int {
	return int(C.freenect_start_depth(dev.ptr()))
}