Fawkes API
Fawkes Development Version
|
Shared memory image buffer. More...
#include <>>
Public Member Functions | |
SharedMemoryImageBuffer (const char *image_id, colorspace_t cspace, unsigned int width, unsigned int height) | |
Write Constructor. | |
SharedMemoryImageBuffer (const char *image_id, bool is_read_only=true) | |
Read Constructor. | |
~SharedMemoryImageBuffer () | |
Destructor. | |
const char * | image_id () const |
Get Image ID. | |
const char * | frame_id () const |
Get frame ID. | |
unsigned char * | buffer () const |
Get image buffer. | |
colorspace_t | colorspace () const |
Get color space. | |
unsigned int | width () const |
Get image width. | |
unsigned int | height () const |
Get image height. | |
unsigned int | roi_x () const |
Get ROI X. | |
unsigned int | roi_y () const |
Get ROI Y. | |
unsigned int | roi_width () const |
Get ROI width. | |
unsigned int | roi_height () const |
Get ROI height. | |
int | circle_x () const |
Get circle X. | |
int | circle_y () const |
Get circle Y. | |
unsigned int | circle_radius () const |
Get circle radius. | |
bool | circle_found () const |
Check if circle was found . | |
void | set_roi_x (unsigned int roi_x) |
Set ROI X. | |
void | set_roi_y (unsigned int roi_y) |
Set ROI Y. | |
void | set_roi_width (unsigned int roi_w) |
Set ROI width. | |
void | set_roi_height (unsigned int roi_h) |
Set ROI height. | |
void | set_roi (unsigned int roi_x, unsigned int roi_y, unsigned int roi_w, unsigned int roi_h) |
Set ROI data. | |
void | set_circle_x (int circle_x) |
Set circle X. | |
void | set_circle_y (int circle_y) |
Set circle Y. | |
void | set_circle_radius (unsigned int circle_radius) |
Set circle radius. | |
void | set_circle (int x, int y, unsigned int r) |
Set circle data. | |
void | set_circle_found (bool found) |
Set circle found. | |
bool | set_image_id (const char *image_id) |
Set image number. | |
void | set_frame_id (const char *frame_id) |
Set frame ID. | |
fawkes::Time | capture_time () const |
Get the time when the image was captured. | |
void | capture_time (long int *sec, long int *usec) const |
Get the time when the image was captured. | |
void | set_capture_time (fawkes::Time *time) |
Set the capture time. | |
void | set_capture_time (long int sec, long int usec) |
Set the capture time. | |
Static Public Member Functions | |
static void | list () |
List all shared memory segments that contain a FireVision image. | |
static void | cleanup (bool use_lister=true) |
Erase all shared memory segments that contain FireVision images. | |
static bool | exists (const char *image_id) |
Check image availability. | |
static void | wipe (const char *image_id) |
Erase a specific shared memory segment that contains an image. |
Shared memory image buffer.
Write images to or retrieve images from a shared memory segment.
firevision::SharedMemoryImageBuffer::SharedMemoryImageBuffer | ( | const char * | image_id, |
colorspace_t | cspace, | ||
unsigned int | width, | ||
unsigned int | height | ||
) |
Write Constructor.
Create a new shared memory segment. Will open a shared memory segment that exactly fits the given information. Will throw an error if image with id image_id exists. I will create a new segment if no matching segment was found. The segment is accessed in read-write mode.
Use this constructor to open a shared memory image buffer for writing.
image_id | image ID to open |
cspace | colorspace |
width | image width |
height | image height |
Definition at line 63 of file shm_image.cpp.
References fawkes::SharedMemory::add_semaphore().
firevision::SharedMemoryImageBuffer::SharedMemoryImageBuffer | ( | const char * | image_id, |
bool | is_read_only = true |
||
) |
Read Constructor.
This constructor is used to search for an existing shared memory segment. It will throw an error if it cannot find a segment with the specified data. The segment is opened read-only by default, but this can be overridden with the is_read_only argument if needed.
Use this constructor to open an image for reading.
image_id | Image ID to open |
is_read_only | true to open image read-only |
Definition at line 87 of file shm_image.cpp.
firevision::SharedMemoryImageBuffer::~SharedMemoryImageBuffer | ( | ) |
unsigned char * firevision::SharedMemoryImageBuffer::buffer | ( | ) | const |
Get image buffer.
Definition at line 234 of file shm_image.cpp.
References fawkes::SharedMemory::_memptr.
Referenced by firevision::FuseImageContent::FuseImageContent(), OpenNiDepthThread::loop(), OpenNiImageThread::loop(), OpenNiPclOnlyThread::loop(), OpenNiUserTrackerThread::loop(), and FvRetrieverThread::loop().
Time firevision::SharedMemoryImageBuffer::capture_time | ( | ) | const |
Get the time when the image was captured.
Definition at line 194 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::capture_time_sec, and firevision::SharedMemoryImageBuffer_header_t::capture_time_usec.
Referenced by firevision::FuseImageContent::FuseImageContent(), and OpenNiPclOnlyThread::loop().
void firevision::SharedMemoryImageBuffer::capture_time | ( | long int * | sec, |
long int * | usec | ||
) | const |
Get the time when the image was captured.
sec | upon return contains the seconds part of the time |
usec | upon return contains the micro seconds part of the time |
Definition at line 184 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::capture_time_sec, and firevision::SharedMemoryImageBuffer_header_t::capture_time_usec.
bool firevision::SharedMemoryImageBuffer::circle_found | ( | ) | const |
Check if circle was found .
Definition at line 482 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::flag_circle_found.
unsigned int firevision::SharedMemoryImageBuffer::circle_radius | ( | ) | const |
Get circle radius.
Definition at line 334 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::circle_radius.
Referenced by set_circle_radius().
int firevision::SharedMemoryImageBuffer::circle_x | ( | ) | const |
Get circle X.
Definition at line 314 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::circle_x.
Referenced by set_circle_x().
int firevision::SharedMemoryImageBuffer::circle_y | ( | ) | const |
Get circle Y.
Definition at line 324 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::circle_y.
Referenced by set_circle_y().
void firevision::SharedMemoryImageBuffer::cleanup | ( | bool | use_lister = true | ) | [static] |
Erase all shared memory segments that contain FireVision images.
use_lister | if true a lister is used to print the shared memory segments to stdout while cleaning up. |
Definition at line 507 of file shm_image.cpp.
References fawkes::SharedMemory::erase_orphaned().
colorspace_t firevision::SharedMemoryImageBuffer::colorspace | ( | ) | const |
Get color space.
Definition at line 244 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::colorspace.
Referenced by firevision::FuseImageContent::FuseImageContent().
bool firevision::SharedMemoryImageBuffer::exists | ( | const char * | image_id | ) | [static] |
Check image availability.
image_id | image ID to check |
Definition at line 528 of file shm_image.cpp.
const char * firevision::SharedMemoryImageBuffer::frame_id | ( | ) | const |
Get frame ID.
Definition at line 173 of file shm_image.cpp.
References firevision::SharedMemoryImageBufferHeader::frame_id().
unsigned int firevision::SharedMemoryImageBuffer::height | ( | ) | const |
Get image height.
Definition at line 264 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::height.
Referenced by firevision::FuseImageContent::FuseImageContent(), and OpenNiPclOnlyThread::init().
const char * firevision::SharedMemoryImageBuffer::image_id | ( | ) | const |
Get Image ID.
Definition at line 163 of file shm_image.cpp.
Referenced by firevision::FuseImageContent::FuseImageContent().
void firevision::SharedMemoryImageBuffer::list | ( | ) | [static] |
List all shared memory segments that contain a FireVision image.
Definition at line 490 of file shm_image.cpp.
unsigned int firevision::SharedMemoryImageBuffer::roi_height | ( | ) | const |
Get ROI height.
Definition at line 304 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::roi_height.
unsigned int firevision::SharedMemoryImageBuffer::roi_width | ( | ) | const |
Get ROI width.
Definition at line 294 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::roi_width.
unsigned int firevision::SharedMemoryImageBuffer::roi_x | ( | ) | const |
Get ROI X.
Definition at line 274 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::roi_x.
Referenced by set_roi_x(), and set_roi().
unsigned int firevision::SharedMemoryImageBuffer::roi_y | ( | ) | const |
Get ROI Y.
Definition at line 284 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::roi_y.
Referenced by set_roi_y(), and set_roi().
void firevision::SharedMemoryImageBuffer::set_capture_time | ( | fawkes::Time * | time | ) |
Set the capture time.
time | capture time |
Definition at line 204 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, fawkes::Time::get_timeval(), firevision::SharedMemoryImageBuffer_header_t::capture_time_sec, and firevision::SharedMemoryImageBuffer_header_t::capture_time_usec.
Referenced by OpenNiDepthThread::loop(), OpenNiImageThread::loop(), and FvRetrieverThread::loop().
void firevision::SharedMemoryImageBuffer::set_capture_time | ( | long int | sec, |
long int | usec | ||
) |
Set the capture time.
sec | seconds part of capture time |
usec | microseconds part of capture time |
Definition at line 220 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::capture_time_sec, and firevision::SharedMemoryImageBuffer_header_t::capture_time_usec.
void firevision::SharedMemoryImageBuffer::set_circle | ( | int | x, |
int | y, | ||
unsigned int | r | ||
) |
Set circle data.
x | circle X |
y | circle Y |
r | circle radius |
Definition at line 457 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::circle_x, firevision::SharedMemoryImageBuffer_header_t::circle_y, and firevision::SharedMemoryImageBuffer_header_t::circle_radius.
void firevision::SharedMemoryImageBuffer::set_circle_found | ( | bool | found | ) |
Set circle found.
found | true if circle found |
Definition at line 472 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::flag_circle_found.
void firevision::SharedMemoryImageBuffer::set_circle_radius | ( | unsigned int | circle_radius | ) |
Set circle radius.
circle_radius | new circle radius |
Definition at line 442 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::circle_radius, and circle_radius().
void firevision::SharedMemoryImageBuffer::set_circle_x | ( | int | circle_x | ) |
Set circle X.
circle_x | new circle X |
Definition at line 416 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::circle_x, and circle_x().
void firevision::SharedMemoryImageBuffer::set_circle_y | ( | int | circle_y | ) |
Set circle Y.
circle_y | new circle Y |
Definition at line 429 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::circle_y, and circle_y().
void firevision::SharedMemoryImageBuffer::set_frame_id | ( | const char * | frame_id | ) |
Set frame ID.
frame_id | new frame ID |
Definition at line 152 of file shm_image.cpp.
References firevision::SharedMemoryImageBufferHeader::set_frame_id(), and firevision::SharedMemoryImageBuffer_header_t::frame_id.
Referenced by OpenNiPointCloudThread::init(), and FvRetrieverThread::init().
bool firevision::SharedMemoryImageBuffer::set_image_id | ( | const char * | image_id | ) |
Set image number.
This will close the currently opened image and will try to open the new image. This operation should be avoided.
image_id | new image ID |
Definition at line 136 of file shm_image.cpp.
References fawkes::SharedMemory::free(), firevision::SharedMemoryImageBufferHeader::set_image_id(), fawkes::SharedMemory::attach(), firevision::SharedMemoryImageBufferHeader::raw_header(), and fawkes::SharedMemory::_memptr.
void firevision::SharedMemoryImageBuffer::set_roi | ( | unsigned int | roi_x, |
unsigned int | roi_y, | ||
unsigned int | roi_w, | ||
unsigned int | roi_h | ||
) |
Set ROI data.
Definition at line 399 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::roi_x, roi_x(), firevision::SharedMemoryImageBuffer_header_t::roi_y, roi_y(), firevision::SharedMemoryImageBuffer_header_t::roi_width, and firevision::SharedMemoryImageBuffer_header_t::roi_height.
void firevision::SharedMemoryImageBuffer::set_roi_height | ( | unsigned int | roi_h | ) |
Set ROI height.
roi_h | new ROI height |
Definition at line 383 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and firevision::SharedMemoryImageBuffer_header_t::roi_height.
void firevision::SharedMemoryImageBuffer::set_roi_width | ( | unsigned int | roi_w | ) |
Set ROI width.
roi_w | new ROI width |
Definition at line 370 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and firevision::SharedMemoryImageBuffer_header_t::roi_width.
void firevision::SharedMemoryImageBuffer::set_roi_x | ( | unsigned int | roi_x | ) |
Set ROI X.
roi_x | new ROI X |
Definition at line 344 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::roi_x, and roi_x().
void firevision::SharedMemoryImageBuffer::set_roi_y | ( | unsigned int | roi_y | ) |
Set ROI Y.
roi_y | new ROI Y |
Definition at line 357 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, firevision::SharedMemoryImageBuffer_header_t::roi_y, and roi_y().
unsigned int firevision::SharedMemoryImageBuffer::width | ( | ) | const |
Get image width.
Definition at line 254 of file shm_image.cpp.
References firevision::SharedMemoryImageBuffer_header_t::width.
Referenced by firevision::FuseImageContent::FuseImageContent(), and OpenNiPclOnlyThread::init().
void firevision::SharedMemoryImageBuffer::wipe | ( | const char * | image_id | ) | [static] |
Erase a specific shared memory segment that contains an image.
image_id | ID of image to wipe |
Definition at line 543 of file shm_image.cpp.
References fawkes::SharedMemory::erase().