![]() |
ARX
1.0
The next-generation open source augmented reality toolkit.
|
A video source provides video frames to the artoolkitX tracking module. More...
#include <ARVideoSource.h>
Public Member Functions | |
ARVideoSource () | |
~ARVideoSource () | |
int | getError () |
bool | isOpen () const |
Returns true if the video source is open. More... | |
bool | isRunning () const |
Returns true if the video source is open and ready to be queried. More... | |
void | configure (const char *vconf, bool noCpara, const char *cparaName, const char *cparaBuff, size_t cparaBuffLen) |
Sets initial parameters which will be used when the video source is opened. More... | |
ARParamLT * | getCameraParameters () const |
Returns the camera parameters for the video source. More... | |
int | getVideoWidth () const |
Returns the width of the video in pixels. More... | |
int | getVideoHeight () const |
Returns the height of the video in pixels. More... | |
AR_PIXEL_FORMAT | getPixelFormat () const |
Returns the pixel format of the video. More... | |
bool | open () |
Opens the video source. More... | |
bool | close () |
Closes the video source. More... | |
bool | captureFrame () |
Asks the video source to capture a frame. More... | |
AR2VideoBufferT * | checkoutFrameIfNewerThan (const AR2VideoTimestampT time) |
Checkout a locked video frame if the frame's timestamp is newer than 'time'. More... | |
void | checkinFrame (void) |
Checkin a locked video frame. More... | |
AR2VideoParamT * | getAR2VideoParam (void) |
Get the underlying AR2VideoParamT settings structure. More... | |
bool | getFrameTextureRGBA32 (uint32_t *buffer) |
Populates the provided color buffer with the current video frame. More... | |
A video source provides video frames to the artoolkitX tracking module.
Video sources contain information about the video, such as size and pixel format, camera parameters for distortion compensation, as well as the raw video data itself.
ARVideoSource::ARVideoSource | ( | ) |
ARVideoSource::~ARVideoSource | ( | ) |
bool ARVideoSource::captureFrame | ( | ) |
Asks the video source to capture a frame.
void ARVideoSource::checkinFrame | ( | void | ) |
Checkin a locked video frame.
Each call to checkoutFrameIfNewerThan() which returns non-NULL MUST be balanced with a call to this function on the same thread.
AR2VideoBufferT * ARVideoSource::checkoutFrameIfNewerThan | ( | const AR2VideoTimestampT | time | ) |
Checkout a locked video frame if the frame's timestamp is newer than 'time'.
This function returns a pointer to the current video frame buffer, but only if the frame's timestamp is newer than the time passed in parameter 'time'. If the return value is non-NULL, the caller has non-exclusive read access to the frame buffer until the next call to checkinFrame(). If the return value is NULL, no further action is required. I.e. each call to this function which returns non-NULL MUST be balanced with a call to checkinFrame() on the same thread. Multiple callers may simultaneously checkout frames, but the next frame will not be made available until all callers have called checkinFrame() on the current frame.
time | Timestamp of frame to compare. Passing a timestamp of {0, 0} will ensure that the timestamp test always passes. |
bool ARVideoSource::close | ( | ) |
Closes the video source.
void ARVideoSource::configure | ( | const char * | vconf, |
bool | noCpara, | ||
const char * | cparaName, | ||
const char * | cparaBuff, | ||
size_t | cparaBuffLen | ||
) |
Sets initial parameters which will be used when the video source is opened.
vconf | Either NULL (the default), to use the default video configuration, or a C-string containing the video configuration to apply. |
noCpara | If false (the default), the default behaviour to determine the camera lens parameters for the video source will be followed. If true, the video source is treated as uncalibrated and attempts to retrieve the camera lens parameters will return NULL. |
cparaName | Either NULL (the default), to use the default method for camera lens parameter discovery, or a C-string containing the filesystem path to a camera lens parameter file. |
cparaBuff | Either NULL (the default), to use the default method for camera lens parameter discovery, or a pointer to an in-memory buffer containing the contents of a camera lens parameter file. If non-NULL, then parameter cparaBuffLen must hold the length of this buffer. |
cparaBuffLen | If parameter cparaBuff is NULL, this value is ignored. If parameter cparaBuff is non-NULL, this value must hold the length of the buffer pointed to by cparaBuff. |
AR2VideoParamT * ARVideoSource::getAR2VideoParam | ( | void | ) |
Get the underlying AR2VideoParamT settings structure.
In some advanced circumstances, users might wish to make direct queries on the underlying AR2VideoParamT structure.
ARParamLT * ARVideoSource::getCameraParameters | ( | ) | const |
Returns the camera parameters for the video source.
int ARVideoSource::getError | ( | ) |
bool ARVideoSource::getFrameTextureRGBA32 | ( | uint32_t * | buffer | ) |
Populates the provided color buffer with the current video frame.
buffer | The color buffer to populate with frame data |
AR_PIXEL_FORMAT ARVideoSource::getPixelFormat | ( | ) | const |
Returns the pixel format of the video.
int ARVideoSource::getVideoHeight | ( | ) | const |
Returns the height of the video in pixels.
int ARVideoSource::getVideoWidth | ( | ) | const |
Returns the width of the video in pixels.
bool ARVideoSource::isOpen | ( | ) | const |
Returns true if the video source is open.
bool ARVideoSource::isRunning | ( | ) | const |
Returns true if the video source is open and ready to be queried.
bool ARVideoSource::open | ( | ) |
Opens the video source.