freenect

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2017 License: MIT Imports: 7 Imported by: 2

README

go-freenect

A Go binding for the libfreenect library.

The libfreenect library makes interfacing between the Kinect and another device easy. Take a look at the examples to get an idea of how the binding works.

Documentation

Overview

Package freenect implements a Go binding for the libfreenect library.

Index

Constants

Constants representing logging verbosity levels, ordered from least to most verbose.

Constants representing various video/depth resolution levels.

View Source
const (
	DepthFormat11Bit       = DepthFormat(C.FREENECT_DEPTH_11BIT)
	DepthFormat10Bit       = DepthFormat(C.FREENECT_DEPTH_10BIT)
	DepthFormat11BitPacked = DepthFormat(C.FREENECT_DEPTH_11BIT_PACKED)
	DepthFormat10BitPacked = DepthFormat(C.FREENECT_DEPTH_10BIT_PACKED)
	DepthFormatRegistered  = DepthFormat(C.FREENECT_DEPTH_REGISTERED)
	DepthFormatMM          = DepthFormat(C.FREENECT_DEPTH_MM)
)

Constants representing various data representations of depth information.

View Source
const (
	VideoFormatRGB           = VideoFormat(C.FREENECT_VIDEO_RGB)
	VideoFormatBayer         = VideoFormat(C.FREENECT_VIDEO_BAYER)
	VideoFormatIR8Bit        = VideoFormat(C.FREENECT_VIDEO_IR_8BIT)
	VideoFormatIR10Bit       = VideoFormat(C.FREENECT_VIDEO_IR_10BIT)
	VideoFormatIR10BitPacked = VideoFormat(C.FREENECT_VIDEO_IR_10BIT_PACKED)
	VideoFormatYUVRGB        = VideoFormat(C.FREENECT_VIDEO_YUV_RGB)
	VideoFormatYUVRaw        = VideoFormat(C.FREENECT_VIDEO_YUV_RAW)
)

Constants representing various data representations of video information.

View Source
const (
	LEDColorOff            = LEDColor(C.LED_OFF)
	LEDColorGreen          = LEDColor(C.LED_GREEN)
	LEDColorRed            = LEDColor(C.LED_RED)
	LEDColorYellow         = LEDColor(C.LED_YELLOW)
	LEDColorBlinkGreen     = LEDColor(C.LED_BLINK_GREEN)
	LEDColorBlinkRedYellow = LEDColor(C.LED_BLINK_RED_YELLOW)
)

Constants representing LED color options.

View Source
const (
	TiltStatusStopped = TiltStatus(C.TILT_STATUS_STOPPED)
	TiltStatusLimit   = TiltStatus(C.TILT_STATUS_LIMIT)
	TiltStatusMoving  = TiltStatus(C.TILT_STATUS_MOVING)
)

Constants representing tilt motor status codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is an object that represents a Freenect context. Many operations are done through this object.

func NewContext

func NewContext() (Context, error)

NewContext creates a new Context object.

func (*Context) Destroy

func (context *Context) Destroy() error

Destroy frees the Context object data.

func (*Context) DeviceCount

func (context *Context) DeviceCount() (int, error)

DeviceCount returns the number of devices connected to the system.

func (*Context) OpenDevice

func (context *Context) OpenDevice(index int) (Device, error)

OpenDevice opens a device of the given index and returns the corresponding Device object.

func (*Context) ProcessEvents

func (context *Context) ProcessEvents(timeout time.Duration) error

ProcessEvents looks for new data from the device or devices and sends the data to the callbacks.

func (*Context) SetLogCallback

func (context *Context) SetLogCallback(callback LogCallback)

SetLogCallback sets the callback function Freenect will call when it has a log message. If this callback is set, Freenect will not automatically print log messages.

func (*Context) SetLogLevel

func (context *Context) SetLogLevel(level LogLevel)

SetLogLevel sets how verbose Freenect should be.

type DepthCallback

type DepthCallback func(device *Device, depth []uint16, timestamp uint32)

DepthCallback is a function that a Device object can call when a new depth frame is available.

type DepthFormat

type DepthFormat int

DepthFormat represents a data representation of depth information.

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device is an object the represents a physical Kinect device.

func (*Device) Destroy

func (device *Device) Destroy()

Destroy frees the Device object memory.

func (*Device) GetAccelerometerState

func (device *Device) GetAccelerometerState() (float64, float64, float64)

GetAccelerometerState returns the axis-based gravity adjusted accelerometer state in the form of x-axis, y-axis, and z-axis states.

func (*Device) GetTiltAngle

func (device *Device) GetTiltAngle() float64

GetTiltAngle returns the current angle the Kinect is tilted.

func (*Device) GetTiltStatus

func (device *Device) GetTiltStatus() TiltStatus

GetTiltStatus returns the current status of the tilting motor.

func (*Device) SetDepthCallback

func (device *Device) SetDepthCallback(callback DepthCallback)

SetDepthCallback sets the callback function that will be called when a new depth frame is available.

func (*Device) SetLED

func (device *Device) SetLED(color LEDColor) error

SetLED sets the color or pattern of the LED on the Kinect.

func (*Device) SetTiltAngle

func (device *Device) SetTiltAngle(degrees float64) error

SetTiltAngle sets the angle the kinect is tilted. Note that the device may not be done tilting when this function returns.

func (*Device) SetVideoCallback

func (device *Device) SetVideoCallback(callback VideoCallback)

SetVideoCallback sets the callback function that will be called when a new video frame is available.

func (*Device) StartDepthStream

func (device *Device) StartDepthStream(resolution Resolution, format DepthFormat) error

StartDepthStream begins the retrieval of depth information from the device.

func (*Device) StartVideoStream

func (device *Device) StartVideoStream(resolution Resolution, format VideoFormat) error

StartVideoStream starts the retrieval of video information from the device.

func (*Device) StopDepthStream

func (device *Device) StopDepthStream() error

StopDepthStream stops the retrieval of depth information from the device.

func (*Device) StopVideoStream

func (device *Device) StopVideoStream() error

StopVideoStream stops the retrieval of video information from the device.

type LEDColor

type LEDColor int

LEDColor represents an LED color option.

type LogCallback

type LogCallback func(*Context, LogLevel, string)

LogCallback is a function type that Freenect uses to deliver log messages to the user.

type LogLevel

type LogLevel int

LogLevel represents a logging verbosity level.

type Resolution

type Resolution int

Resolution represents a video/depth stream resolution format.

type TiltStatus

type TiltStatus int

TiltStatus represents a tilt motor status code.

type VideoCallback

type VideoCallback func(device *Device, video []byte, timestamp uint32)

VideoCallback is a function that a Device object can call when a new video frame is available.

type VideoFormat

type VideoFormat int

VideoFormat represents a data representation of color information.

Directories

Path Synopsis
This is a simple example of a program that uses go-freenect.
This is a simple example of a program that uses go-freenect.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL