![]() |
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>
Classes | |
| struct | Size |
Public Types | |
| enum class | ScalingMode { SCALE_MODE_STRETCH , SCALE_MODE_FIT , SCALE_MODE_FILL , SCALE_MODE_1_TO_1 } |
Public Member Functions | |
| ARVideoSource () | |
| ~ARVideoSource () | |
| int | getError () |
| bool | isOpen () const |
| Returns true if the video source is open. | |
| bool | isRunning () const |
| Returns true if the video source is open and ready to be queried. | |
| 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. | |
| ARParamLT * | getCameraParameters () const |
| Returns the camera parameters for the video source. | |
| ARParam * | getCameraParametersForViewportSizeAndFittingMode (const Size viewportSize, const ScalingMode scalingMode) |
| Adjust camera parameters to fit an output viewport of given size, using fitting and alignment. | |
| int | getVideoWidth () const |
| Returns the width of the video in pixels. | |
| int | getVideoHeight () const |
| Returns the height of the video in pixels. | |
| AR_PIXEL_FORMAT | getPixelFormat () const |
| Returns the pixel format of the video. | |
| bool | open () |
| Opens the video source. | |
| bool | close () |
| Closes the video source. | |
| bool | captureFrame () |
| Asks the video source to capture a frame. | |
| AR2VideoBufferT * | checkoutFrameIfNewerThan (const AR2VideoTimestampT time) |
| Checkout a locked video frame if the frame's timestamp is newer than 'time'. | |
| void | checkinFrame (void) |
| Checkin a locked video frame. | |
| AR2VideoParamT * | getAR2VideoParam (void) |
| Get the underlying AR2VideoParamT settings structure. | |
| bool | getFrameTextureRGBA32 (uint32_t *buffer) |
| Populates the provided color buffer with the current video frame. | |
| int | videoPushInit (int width, int height, const char *pixelFormat, int cameraIndex, int cameraPosition) |
| int | videoPush (ARUint8 *buf0p, int buf0Size, int buf0PixelStride, int buf0RowStride, ARUint8 *buf1p, int buf1Size, int buf1PixelStride, int buf1RowStride, ARUint8 *buf2p, int buf2Size, int buf2PixelStride, int buf2RowStride, ARUint8 *buf3p, int buf3Size, int buf3PixelStride, int buf3RowStride) |
| int | videoPushFinal (void) |
Static Public Member Functions | |
| static const std::string | ScalingModeName (const ScalingMode scalingMode) |
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.
|
strong |
| ARVideoSource::ARVideoSource | ( | ) |
| ARVideoSource::~ARVideoSource | ( | ) |
| bool ARVideoSource::captureFrame | ( | ) |
Asks the video source to capture a frame.
Query the current video source for availability of a new frame, and if one is available, update the current video frame buffer to point to the new 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. The function will block if the current video frame is currently being updated (or waiting to be updated) until the update is complete.
| 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.
| ARParam * ARVideoSource::getCameraParametersForViewportSizeAndFittingMode | ( | const Size | viewportSize, |
| const ScalingMode | scalingMode | ||
| ) |
Adjust camera parameters to fit an output viewport of given size, using fitting and alignment.
| 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.
|
inlinestatic |
| int ARVideoSource::videoPush | ( | ARUint8 * | buf0p, |
| int | buf0Size, | ||
| int | buf0PixelStride, | ||
| int | buf0RowStride, | ||
| ARUint8 * | buf1p, | ||
| int | buf1Size, | ||
| int | buf1PixelStride, | ||
| int | buf1RowStride, | ||
| ARUint8 * | buf2p, | ||
| int | buf2Size, | ||
| int | buf2PixelStride, | ||
| int | buf2RowStride, | ||
| ARUint8 * | buf3p, | ||
| int | buf3Size, | ||
| int | buf3PixelStride, | ||
| int | buf3RowStride | ||
| ) |
| int ARVideoSource::videoPushFinal | ( | void | ) |
| int ARVideoSource::videoPushInit | ( | int | width, |
| int | height, | ||
| const char * | pixelFormat, | ||
| int | cameraIndex, | ||
| int | cameraPosition | ||
| ) |
1.9.6