#include <Camera.h>
Public Member Functions | |
Camera (dc1394camera_t *camera) | |
Camera () | |
void | captureColorMat (cv::Mat &bgrMat, uint64_t ×tamp, bool wait=true) |
void | debayerFrame (dc1394video_frame_t *in, dc1394video_frame_t *out) |
dc1394video_frame_t * | dequeueFrame (const dc1394capture_policy_t capturePolicy) |
void | dropFrames (int n) |
void | enqueueFrameLater (const dc1394video_frame_t *frame) |
void | enqueueFrames () |
void | flushFrames () |
dc1394bayer_method_t | getBayerMethod () |
uint32_t | getControlRegister (uint64_t offset) |
float | getFeatureAbsoluteValue (dc1394feature_t feat) |
float | getFeatureMaxAbsoluteBoundary (dc1394feature_t feat) |
uint32_t | getFeatureMaxBoundary (dc1394feature_t feat) |
float | getFeatureMinAbsoluteBoundary (dc1394feature_t feat) |
uint32_t | getFeatureMinBoundary (dc1394feature_t feat) |
dc1394feature_mode_t | getFeatureMode (dc1394feature_t feat) |
uint32_t | getFeatureValue (dc1394feature_t feat) |
dc1394color_coding_t | getFormat7ColorCoding () |
dc1394color_filter_t | getFormat7ColorFilter () |
float | getFormat7FrameInterval () |
uint32_t | getFormat7PacketSize () |
uint32_t | getFormat7PacketsPerFrame () |
uint32_t | getFormat7RecommendedPacketSize () |
void | getFormat7Roi (dc1394video_mode_t videoMode, dc1394color_coding_t *colorCoding, uint32_t *packetSize, uint32_t *left, uint32_t *top, uint32_t *width, uint32_t *height) |
dc1394speed_t | getIsoSpeed () |
dc1394operation_mode_t | getOperationMode () |
uint32_t | getRegister (uint64_t offset) |
dc1394video_mode_t | getVideoMode () |
uint32_t | getWhiteBalanceBlue () |
uint32_t | getWhiteBalanceRed () |
bool | isFeatureAbsoluteControlAvailable (dc1394feature_t feat) |
bool | isFeatureAbsoluteControlOn (dc1394feature_t feat) |
bool | isFeaturePowerOn (dc1394feature_t feat) |
bool | isFeaturePresent (dc1394feature_t feat) |
bool | isFeatureReadable (dc1394feature_t feat) |
bool | isFeatureSwitchable (dc1394feature_t feat) |
bool | isFrameCorrupt (dc1394video_frame_t *frame) |
void | lockCapture () |
void | powerOff () |
void | powerOn () |
void | releaseAll () |
void | reset () |
void | resetBus () |
void | setBayerMethod (dc1394bayer_method_t method) |
void | setControlRegister (uint64_t offset, uint32_t value) |
void | setFeatureAbsoluteControlOff (dc1394feature_t feat) |
void | setFeatureAbsoluteControlOn (dc1394feature_t feat) |
void | setFeatureAbsoluteValue (dc1394feature_t feat, float value) |
void | setFeaturePowerOff (dc1394feature_t feat) |
void | setFeaturePowerOn (dc1394feature_t feat) |
void | setFeaturetMode (dc1394feature_t feat, dc1394feature_mode_t mode) |
void | setFeatureValue (dc1394feature_t feat, uint32_t value) |
virtual void | setFormat7Roi (dc1394video_mode_t videoMode, dc1394color_coding_t colorCoding, int32_t packetSize, int32_t left, int32_t top, int32_t width, int32_t height) |
void | setIsoSpeed (dc1394speed_t speed) |
void | setOperationMode (dc1394operation_mode_t operationMode) |
void | setRegister (uint64_t offset, uint32_t value) |
void | setup () |
void | setupCapture () |
void | setVideoMode (dc1394video_mode_t videoMode) |
void | setWhiteBalance (uint32_t u_b_value, uint32_t v_r_value) |
void | setWhiteBalanceBlue (uint32_t u_b_value) |
void | setWhiteBalanceRed (uint32_t v_r_value) |
void | startOneShot () |
void | startVideoTransmission () |
void | stopCapture () |
void | stopOneShot () |
void | stopVideoTransmission () |
void | unlockCapture () |
virtual | ~Camera () |
Private Attributes | |
dc1394bayer_method_t | bayerMethod |
dc1394camera_t * | camera |
pthread_mutex_t | captureMutex |
std::queue< dc1394video_frame_t * > | dequeuedFrames |
std::set< dc1394video_frame_t * > | framesToEnqueue |
Object wrapper for libdc1394 cameras. libdc1394 errors generally result into exceptions.
Thread-safe for capturing from multiple threads. Ensures that frames are enqueued in the same order as they were dequeued. Getters/setters thread-safety depends on libdc1394, which is claimed to be thread-safe too.
nifti::dc1394::Camera::Camera | ( | dc1394camera_t * | camera | ) |
Definition at line 22 of file Camera.cpp.
Definition at line 17 of file Camera.cpp.
nifti::dc1394::Camera::~Camera | ( | ) | [virtual] |
Definition at line 27 of file Camera.cpp.
void nifti::dc1394::Camera::captureColorMat | ( | cv::Mat & | bgrMat, |
uint64_t & | timestamp, | ||
bool | wait = true |
||
) |
Captures a frame.
bgrMat | color image matrix |
timestamp | frame timestamp |
wait | 'wait for frame' flag |
Definition at line 308 of file Camera.cpp.
void nifti::dc1394::Camera::debayerFrame | ( | dc1394video_frame_t * | in, |
dc1394video_frame_t * | out | ||
) |
Debayers the in frame, fills the out frame with color image. Output color-coding is DC1394_COLOR_CODING_RGB8. Do not pre-allocate the image buffer of the out frame.
in | pointer to the source frame, not null. |
out | pointer to the output frame, not null. |
Definition at line 294 of file Camera.cpp.
dc1394video_frame_t * nifti::dc1394::Camera::dequeueFrame | ( | const dc1394capture_policy_t | capturePolicy | ) |
Dequeues a frame from DMA buffer and returns its pointer. Thread-safe. After processing, the frame must be returned back to the buffer by calling enqueueFrameLater and enqueueFrames.
capturePolicy | a capture policy to use (wait/poll). |
Definition at line 251 of file Camera.cpp.
void nifti::dc1394::Camera::dropFrames | ( | int | n | ) |
Drops the specified number of frames, waits for frames.
Definition at line 212 of file Camera.cpp.
void nifti::dc1394::Camera::enqueueFrameLater | ( | const dc1394video_frame_t * | frame | ) |
Marks the frame as ready for enqueuing. Thread-safe.
frame | pointer to the frame. |
Definition at line 269 of file Camera.cpp.
void nifti::dc1394::Camera::enqueueFrames | ( | ) |
Enqueue all frames marked as ready, e.g. using enqueueFrameLater. Thread-safe.
Definition at line 276 of file Camera.cpp.
void nifti::dc1394::Camera::flushFrames | ( | ) |
Flashes all frames, does not wait for frames.
Definition at line 192 of file Camera.cpp.
dc1394bayer_method_t nifti::dc1394::Camera::getBayerMethod | ( | ) |
Definition at line 446 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getControlRegister | ( | uint64_t | offset | ) |
Definition at line 468 of file Camera.cpp.
float nifti::dc1394::Camera::getFeatureAbsoluteValue | ( | dc1394feature_t | feat | ) |
Returns the current absolute value of the feature.
Definition at line 582 of file Camera.cpp.
float nifti::dc1394::Camera::getFeatureMaxAbsoluteBoundary | ( | dc1394feature_t | feat | ) |
Returns the maximum absolute value of the feature.
Definition at line 573 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getFeatureMaxBoundary | ( | dc1394feature_t | feat | ) |
Returns the maximum value of the feature.
Definition at line 547 of file Camera.cpp.
float nifti::dc1394::Camera::getFeatureMinAbsoluteBoundary | ( | dc1394feature_t | feat | ) |
Returns the minimum absolute value of the feature.
Definition at line 564 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getFeatureMinBoundary | ( | dc1394feature_t | feat | ) |
Returns the minimum value of the feature.
Definition at line 538 of file Camera.cpp.
dc1394feature_mode_t nifti::dc1394::Camera::getFeatureMode | ( | dc1394feature_t | feat | ) |
Returns the feature mode.
Definition at line 514 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getFeatureValue | ( | dc1394feature_t | feat | ) |
Returns the current value of the feature.
Definition at line 556 of file Camera.cpp.
dc1394color_coding_t nifti::dc1394::Camera::getFormat7ColorCoding | ( | ) |
Returns Format 7 colod coding.
Definition at line 41 of file Camera.cpp.
dc1394color_filter_t nifti::dc1394::Camera::getFormat7ColorFilter | ( | ) |
Return Format 7 color filter.
Definition at line 49 of file Camera.cpp.
Returns Format 7 frame interval.
Definition at line 57 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getFormat7PacketSize | ( | ) |
Returns current Format 7 packet size.
Definition at line 73 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getFormat7PacketsPerFrame | ( | ) |
Returns number of packets per frame for Format 7.
Definition at line 65 of file Camera.cpp.
Returns recommended Format 7 packet size.
Definition at line 81 of file Camera.cpp.
void nifti::dc1394::Camera::getFormat7Roi | ( | dc1394video_mode_t | videoMode, |
dc1394color_coding_t * | colorCoding, | ||
uint32_t * | packetSize, | ||
uint32_t * | left, | ||
uint32_t * | top, | ||
uint32_t * | width, | ||
uint32_t * | height | ||
) |
Returns Format 7 ROI.
Definition at line 140 of file Camera.cpp.
dc1394speed_t nifti::dc1394::Camera::getIsoSpeed | ( | ) |
Returns the ISO speed.
Definition at line 106 of file Camera.cpp.
dc1394operation_mode_t nifti::dc1394::Camera::getOperationMode | ( | ) |
Returns the operation mode.
Definition at line 89 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getRegister | ( | uint64_t | offset | ) |
Returns value of the camera register.
Definition at line 454 of file Camera.cpp.
dc1394video_mode_t nifti::dc1394::Camera::getVideoMode | ( | ) |
Returns the video mode.
Definition at line 123 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getWhiteBalanceBlue | ( | ) |
Returns the value of the blue (in RGB) (U in YUV) channel.
Definition at line 632 of file Camera.cpp.
uint32_t nifti::dc1394::Camera::getWhiteBalanceRed | ( | ) |
Returns the value of the red (in RGB) (V in YUV) channel.
Definition at line 641 of file Camera.cpp.
bool nifti::dc1394::Camera::isFeatureAbsoluteControlAvailable | ( | dc1394feature_t | feat | ) |
Returns true if feature absolute control is available, false otherwise.
Definition at line 522 of file Camera.cpp.
bool nifti::dc1394::Camera::isFeatureAbsoluteControlOn | ( | dc1394feature_t | feat | ) |
Returns true if feature absolute control is on, false otherwise.
Definition at line 530 of file Camera.cpp.
bool nifti::dc1394::Camera::isFeaturePowerOn | ( | dc1394feature_t | feat | ) |
Returns true if the feature is powered on, false otherwise.
Definition at line 506 of file Camera.cpp.
bool nifti::dc1394::Camera::isFeaturePresent | ( | dc1394feature_t | feat | ) |
Returns true if the feature is present, false otherwise.
Definition at line 482 of file Camera.cpp.
bool nifti::dc1394::Camera::isFeatureReadable | ( | dc1394feature_t | feat | ) |
Returns true if the feature is readable, false otherwise.
Definition at line 490 of file Camera.cpp.
bool nifti::dc1394::Camera::isFeatureSwitchable | ( | dc1394feature_t | feat | ) |
Returns true if the feature is switchable, false otherwise. False means that feature is always on.
Definition at line 498 of file Camera.cpp.
bool nifti::dc1394::Camera::isFrameCorrupt | ( | dc1394video_frame_t * | frame | ) |
Definition at line 265 of file Camera.cpp.
void nifti::dc1394::Camera::lockCapture | ( | ) |
Captures the dequeue/enqueue lock.
Definition at line 243 of file Camera.cpp.
void nifti::dc1394::Camera::powerOff | ( | ) |
Powers off the camera.
Definition at line 418 of file Camera.cpp.
void nifti::dc1394::Camera::powerOn | ( | ) |
Powers on the camera.
Definition at line 411 of file Camera.cpp.
void nifti::dc1394::Camera::releaseAll | ( | ) |
Releases all previously allocated ISO channels and bandwidth.
Definition at line 439 of file Camera.cpp.
void nifti::dc1394::Camera::reset | ( | ) |
Resets the camera to factory default settings.
Definition at line 425 of file Camera.cpp.
void nifti::dc1394::Camera::resetBus | ( | ) |
Resets the bus to which this camera is attached.
Definition at line 432 of file Camera.cpp.
void nifti::dc1394::Camera::setBayerMethod | ( | dc1394bayer_method_t | method | ) |
Definition at line 450 of file Camera.cpp.
void nifti::dc1394::Camera::setControlRegister | ( | uint64_t | offset, |
uint32_t | value | ||
) |
Definition at line 476 of file Camera.cpp.
void nifti::dc1394::Camera::setFeatureAbsoluteControlOff | ( | dc1394feature_t | feat | ) |
Definition at line 614 of file Camera.cpp.
void nifti::dc1394::Camera::setFeatureAbsoluteControlOn | ( | dc1394feature_t | feat | ) |
Definition at line 608 of file Camera.cpp.
void nifti::dc1394::Camera::setFeatureAbsoluteValue | ( | dc1394feature_t | feat, |
float | value | ||
) |
Sets feature absolute value (should be within absolute boundaries & absolute control should be enabled).
Definition at line 626 of file Camera.cpp.
void nifti::dc1394::Camera::setFeaturePowerOff | ( | dc1394feature_t | feat | ) |
Definition at line 596 of file Camera.cpp.
void nifti::dc1394::Camera::setFeaturePowerOn | ( | dc1394feature_t | feat | ) |
Definition at line 590 of file Camera.cpp.
void nifti::dc1394::Camera::setFeaturetMode | ( | dc1394feature_t | feat, |
dc1394feature_mode_t | mode | ||
) |
Sets feature mode.
Possible values (for convenience, see dc1394feature_mode_t definition): DC1394_FEATURE_MODE_MANUAL DC1394_FEATURE_MODE_AUTO DC1394_FEATURE_MODE_ONE_PUSH_AUTO
Definition at line 602 of file Camera.cpp.
void nifti::dc1394::Camera::setFeatureValue | ( | dc1394feature_t | feat, |
uint32_t | value | ||
) |
Sets feature value (should be within the boundaries).
Definition at line 620 of file Camera.cpp.
void nifti::dc1394::Camera::setFormat7Roi | ( | dc1394video_mode_t | videoMode, |
dc1394color_coding_t | colorCoding, | ||
int32_t | packetSize, | ||
int32_t | left, | ||
int32_t | top, | ||
int32_t | width, | ||
int32_t | height | ||
) | [virtual] |
Sets Format 7 ROI.
Definition at line 151 of file Camera.cpp.
void nifti::dc1394::Camera::setIsoSpeed | ( | dc1394speed_t | speed | ) |
Sets the ISO speed.
Definition at line 116 of file Camera.cpp.
void nifti::dc1394::Camera::setOperationMode | ( | dc1394operation_mode_t | operationMode | ) |
Sets the operation mode.
Definition at line 99 of file Camera.cpp.
void nifti::dc1394::Camera::setRegister | ( | uint64_t | offset, |
uint32_t | value | ||
) |
Sets value of the camera register.
Definition at line 462 of file Camera.cpp.
void nifti::dc1394::Camera::setup | ( | ) |
Setup operation mode, ISO speed, video mode, ROI etc.
Definition at line 32 of file Camera.cpp.
void nifti::dc1394::Camera::setupCapture | ( | ) |
Initializes DMA buffers.
Definition at line 161 of file Camera.cpp.
void nifti::dc1394::Camera::setVideoMode | ( | dc1394video_mode_t | videoMode | ) |
Sets the video mode.
Definition at line 133 of file Camera.cpp.
void nifti::dc1394::Camera::setWhiteBalance | ( | uint32_t | u_b_value, |
uint32_t | v_r_value | ||
) |
Sets the value of the blue (in RGB) (U in YUV) and red (in RGB) (V in YUV) channel.
Definition at line 650 of file Camera.cpp.
void nifti::dc1394::Camera::setWhiteBalanceBlue | ( | uint32_t | u_b_value | ) |
Sets the value of the blue (in RGB) (U in YUV) channel.
Definition at line 656 of file Camera.cpp.
void nifti::dc1394::Camera::setWhiteBalanceRed | ( | uint32_t | v_r_value | ) |
Sets the value of the red (in RGB) (V in YUV) channel.
Definition at line 662 of file Camera.cpp.
void nifti::dc1394::Camera::startOneShot | ( | ) |
Enables one-shot video. Then a single frame may be captured by captureColorMat.
Not in effect when video transmission is enabled. User may want to flush unwanted frames before.
Definition at line 229 of file Camera.cpp.
Starts video transmission using initialized buffers.
Definition at line 178 of file Camera.cpp.
void nifti::dc1394::Camera::stopCapture | ( | ) |
Frees initialized DMS buffers.
Definition at line 171 of file Camera.cpp.
void nifti::dc1394::Camera::stopOneShot | ( | ) |
Disables one-shot video.
Definition at line 236 of file Camera.cpp.
Stops video transmission.
Definition at line 185 of file Camera.cpp.
void nifti::dc1394::Camera::unlockCapture | ( | ) |
Releases the dequeue/enqueue lock.
Definition at line 247 of file Camera.cpp.
dc1394bayer_method_t nifti::dc1394::Camera::bayerMethod [private] |
dc1394camera_t* nifti::dc1394::Camera::camera [private] |
pthread_mutex_t nifti::dc1394::Camera::captureMutex [private] |
std::queue<dc1394video_frame_t*> nifti::dc1394::Camera::dequeuedFrames [private] |
std::set<dc1394video_frame_t*> nifti::dc1394::Camera::framesToEnqueue [private] |