Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions include/libfreenect2/frame_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,24 @@ class LIBFREENECT2_API Frame
float gain; ///< Get the gain set by the color camera.
float gamma; ///< Get the gamma level set by the color camera.

Frame(size_t width, size_t height, size_t bytes_per_pixel) :
/** Construct a new frame.
* @param width Width in pixel
* @param height Height in pixel
* @param bytes_per_pixel Bytes per pixel
* @param data_ Memory to store frame data. If `NULL`, new memory is allocated.
*/
Frame(size_t width, size_t height, size_t bytes_per_pixel, unsigned char *data_ = NULL) :
width(width),
height(height),
bytes_per_pixel(bytes_per_pixel),
data(data_),
exposure(0.f),
gain(0.f),
gamma(0.f)
gamma(0.f),
rawdata(NULL)
{
if (data_)
return;
const size_t alignment = 64;
size_t space = width * height * bytes_per_pixel + alignment;
rawdata = new unsigned char[space];
Expand All @@ -74,7 +84,7 @@ class LIBFREENECT2_API Frame
data = reinterpret_cast<unsigned char *>(aligned);
}

~Frame()
virtual ~Frame()
{
delete[] rawdata;
}
Expand Down