libfreenect2 0.4
Open source driver for the Kinect for Windows v2 (K4W2) sensor
Loading...
Searching...
No Matches

Frame format and metadata. More...

#include <libfreenect2/frame_listener.hpp>

Public Types

enum  Type { Color = 1 , Ir = 2 , Depth = 4 }
 Available types of frames. More...
enum  Format {
  Invalid = 0 , Raw = 1 , Float = 2 , BGRX = 4 ,
  RGBX = 5 , Gray = 6
}
 Pixel format. More...

Public Member Functions

 Frame (size_t width_arg, size_t height_arg, size_t bytes_per_pixel_arg, unsigned char *data_arg=NULL)
 Construct a new frame.
 Frame (size_t width_arg, size_t height_arg, size_t bytes_per_pixel_arg, unsigned char *data_arg, Format format_arg)
 Construct a frame with an explicit pixel format.
virtual ~Frame ()

Public Attributes

size_t width
 Length of a line (in pixels).
size_t height
 Number of lines in the frame.
size_t bytes_per_pixel
 Number of bytes in a pixel. If frame format is 'Raw' this is the buffer size.
unsigned char * data
 Data of the frame (aligned).
uint32_t timestamp
 Unit: 0.125 millisecond. Usually incrementing by 266 (30Hz) or 533 (15Hz).
uint64_t arrival_timestamp_us
 Monotonic host time of the first contributing USB transfer, in microseconds.
uint32_t sequence
 Increasing frame sequence number.
float exposure
 From 0.5 (very bright) to ~60.0 (fully covered).
float gain
 From 1.0 (bright) to 1.5 (covered).
float gamma
 From 1.0 (bright) to 6.4 (covered).
uint32_t status
 zero if ok; non-zero for errors.
Format format
 Byte format.

Protected Attributes

unsigned char * rawdata
 Unaligned start of data.

Detailed Description

Frame format and metadata.

Member Enumeration Documentation

◆ Type

enum Type

Available types of frames.

Enumerator
Color 

1920x1080. BGRX or RGBX.

Ir 

512x424 float. Range is [0.0, 65535.0].

Depth 

512x424 float, unit: millimeter. Non-positive, NaN, and infinity are invalid or missing data.

◆ Format

enum Format

Pixel format.

Enumerator
Invalid 

Invalid format.

Raw 

Raw bitstream. 'bytes_per_pixel' defines the number of bytes.

Float 

A 4-byte float per pixel.

BGRX 

4 bytes of B, G, R, and unused per pixel

RGBX 

4 bytes of R, G, B, and unused per pixel

Gray 

1 byte of gray per pixel

Constructor & Destructor Documentation

◆ Frame() [1/2]

Frame ( size_t width_arg,
size_t height_arg,
size_t bytes_per_pixel_arg,
unsigned char * data_arg = NULL )

Construct a new frame.

Parameters
width_argWidth in pixel
height_argHeight in pixel
bytes_per_pixel_argBytes per pixel
data_argMemory to store frame data. If NULL, new memory is allocated.

◆ Frame() [2/2]

Frame ( size_t width_arg,
size_t height_arg,
size_t bytes_per_pixel_arg,
unsigned char * data_arg,
Format format_arg )

Construct a frame with an explicit pixel format.

This overload is intended for callers wrapping externally owned image buffers. Consumers such as Registration validate format and will reject the legacy constructor's default Invalid value.

◆ ~Frame()

virtual ~Frame ( )
virtual

Member Data Documentation

◆ width

size_t width

Length of a line (in pixels).

◆ height

size_t height

Number of lines in the frame.

◆ bytes_per_pixel

size_t bytes_per_pixel

Number of bytes in a pixel. If frame format is 'Raw' this is the buffer size.

◆ data

unsigned char* data

Data of the frame (aligned).

See also
See Frame::Type for pixel format.

◆ timestamp

uint32_t timestamp

Unit: 0.125 millisecond. Usually incrementing by 266 (30Hz) or 533 (15Hz).

◆ arrival_timestamp_us

uint64_t arrival_timestamp_us

Monotonic host time of the first contributing USB transfer, in microseconds.

◆ sequence

uint32_t sequence

Increasing frame sequence number.

◆ exposure

float exposure

From 0.5 (very bright) to ~60.0 (fully covered).

◆ gain

float gain

From 1.0 (bright) to 1.5 (covered).

◆ gamma

float gamma

From 1.0 (bright) to 6.4 (covered).

◆ status

uint32_t status

zero if ok; non-zero for errors.

◆ format

Format format

Byte format.

Validated by consumers such as Registration::apply() and the vision helpers; the constructor defaults it to Invalid, so callers wrapping their own buffers must set it explicitly.

◆ rawdata

unsigned char* rawdata
protected

Unaligned start of data.