![]() |
ViSP
2.6.2
|
#include <vpOpenCVGrabber.h>
Public Member Functions | |
vpOpenCVGrabber () | |
~vpOpenCVGrabber () | |
void | open () |
void | open (vpImage< unsigned char > &I) |
void | open (vpImage< vpRGBa > &I) |
void | acquire (vpImage< unsigned char > &I) |
void | acquire (vpImage< vpRGBa > &I) |
IplImage * | acquire () |
void | close () |
void | getFramerate (double &framerate) |
void | setFramerate (const double framerate) |
void | setWidth (const unsigned int width) |
void | setHeight (const unsigned int height) |
void | setDeviceType (int type) |
void | setFlip (bool flipType) |
unsigned int | getHeight () const |
unsigned int | getWidth () const |
Public Attributes | |
bool | init |
Protected Attributes | |
unsigned int | height |
unsigned int | width |
Class for cameras video capture using OpenCV library.
Needs OpenCV available on http://opencv.willowgarage.com/wiki/.
The code below shows how to use this class.
Note that it is also possible to grab images using OpenCV library by using directly cv::VideoCapture OpenCV class. The following code corresponding to grabOpenCV-2.cpp example shows how to acquire an image with cv::VideoCapture, how to transform this image in ViSP format and how to display it.
Definition at line 155 of file vpOpenCVGrabber.h.
vpOpenCVGrabber::vpOpenCVGrabber | ( | ) |
Basic Constructor.
Definition at line 60 of file vpOpenCVGrabber.cpp.
References vpFrameGrabber::height, vpFrameGrabber::init, and vpFrameGrabber::width.
vpOpenCVGrabber::~vpOpenCVGrabber | ( | ) |
Basic destructor that calls the close() method.
Definition at line 80 of file vpOpenCVGrabber.cpp.
References close().
|
virtual |
Grab a gray level image.
I | : Acquired gray level image. |
vpFrameGrabberException::initializationError | If the initialization of the grabber was not done previously. |
Implements vpFrameGrabber.
Definition at line 144 of file vpOpenCVGrabber.cpp.
References close(), vpImageConvert::convert(), vpFrameGrabber::init, and vpFrameGrabberException::initializationError.
Grab a color image.
I | : Acquired color image. |
vpFrameGrabberException::initializationError | If the initialization of the grabber was not done previously. |
Implements vpFrameGrabber.
Definition at line 168 of file vpOpenCVGrabber.cpp.
References close(), vpImageConvert::convert(), vpFrameGrabber::init, and vpFrameGrabberException::initializationError.
IplImage * vpOpenCVGrabber::acquire | ( | ) |
Grab an image direclty in the OpenCV format.
vpFrameGrabberException::initializationError | If the initialization of the grabber was not done previously. |
Definition at line 192 of file vpOpenCVGrabber.cpp.
References close(), vpFrameGrabber::init, and vpFrameGrabberException::initializationError.
|
virtual |
Stop the acquisition of images and free the camera.
Implements vpFrameGrabber.
Definition at line 211 of file vpOpenCVGrabber.cpp.
References vpFrameGrabber::init.
Referenced by acquire(), open(), setHeight(), setWidth(), and ~vpOpenCVGrabber().
void vpOpenCVGrabber::getFramerate | ( | double & | framerate | ) |
Gets the capture frame rate.
framerate | : The value of the framerate is returned here. |
Definition at line 225 of file vpOpenCVGrabber.cpp.
|
inlineinherited |
Return the number of rows in the image.
Definition at line 119 of file vpFrameGrabber.h.
Referenced by vp1394Grabber::acquire(), and vp1394Grabber::open().
|
inlineinherited |
Return the number of columns in the image.
Definition at line 121 of file vpFrameGrabber.h.
Referenced by vp1394Grabber::acquire(), and vp1394Grabber::open().
void vpOpenCVGrabber::open | ( | ) |
Generic initialization of the grabber.
Definition at line 89 of file vpOpenCVGrabber.cpp.
References close(), vpFrameGrabber::init, and vpFrameGrabberException::initializationError.
Referenced by open().
|
virtual |
Initialization of the grabber. Call the generic initialization method.
I | : Gray level image. This parameter is not used. |
Implements vpFrameGrabber.
Definition at line 116 of file vpOpenCVGrabber.cpp.
References open().
Initialization of the grabber. Call the generic initialization method.
I | : Color image. This parameter is not used. |
Implements vpFrameGrabber.
Definition at line 130 of file vpOpenCVGrabber.cpp.
References open().
void vpOpenCVGrabber::setDeviceType | ( | int | type | ) |
Set the expected type of device.
type | : expected type of device
|
Definition at line 303 of file vpOpenCVGrabber.cpp.
References vpTRACE.
void vpOpenCVGrabber::setFlip | ( | bool | flipType | ) |
Set the boolean variable flip to the expected value.
flipType | : Expected value of the variable flip. True means that the image is flipped during each image acquisition. |
Definition at line 323 of file vpOpenCVGrabber.cpp.
void vpOpenCVGrabber::setFramerate | ( | const double | framerate | ) |
Sets the capture frame rate
framerate | : The requested value of the capture framerate. |
Definition at line 237 of file vpOpenCVGrabber.cpp.
void vpOpenCVGrabber::setHeight | ( | const unsigned int | height | ) |
Sets the captured image height.
height | : The requested value of the captured image height. |
vpFrameGrabberException::initializationError | If no camera was found. |
Definition at line 276 of file vpOpenCVGrabber.cpp.
References close(), vpFrameGrabber::height, vpFrameGrabberException::initializationError, and vpERROR_TRACE.
void vpOpenCVGrabber::setWidth | ( | const unsigned int | width | ) |
Sets the captured image width.
width | : The requested value of the captured image width. |
vpFrameGrabberException::initializationError | If no camera was found. |
Definition at line 253 of file vpOpenCVGrabber.cpp.
References close(), vpFrameGrabberException::initializationError, vpERROR_TRACE, and vpFrameGrabber::width.
|
protectedinherited |
Number of rows in the image.
Definition at line 113 of file vpFrameGrabber.h.
Referenced by vpDiskGrabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vp1394TwoGrabber::dequeue(), vp1394Grabber::getHeight(), vp1394TwoGrabber::getHeight(), vpDiskGrabber::open(), vpVideoReader::open(), vpV4l2Grabber::open(), setHeight(), vpV4l2Grabber::setHeight(), vp1394TwoGrabber::setVideoMode(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpOpenCVGrabber(), and vpV4l2Grabber::vpV4l2Grabber().
|
inherited |
Set to true if the frame grabber has been initialized.
Definition at line 111 of file vpFrameGrabber.h.
Referenced by acquire(), vp1394Grabber::acquire(), vpV4l2Grabber::acquire(), vp1394CMUGrabber::acquire(), close(), vp1394CMUGrabber::close(), vp1394TwoGrabber::close(), vpDiskGrabber::open(), open(), vp1394Grabber::open(), vpV4l2Grabber::open(), vp1394TwoGrabber::resetBus(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394Grabber::vp1394Grabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpDiskGrabber::vpDiskGrabber(), vpOpenCVGrabber(), and vpV4l2Grabber::vpV4l2Grabber().
|
protectedinherited |
Number of columns in the image.
Definition at line 114 of file vpFrameGrabber.h.
Referenced by vpDiskGrabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vp1394TwoGrabber::dequeue(), vp1394Grabber::getWidth(), vp1394TwoGrabber::getWidth(), vpDiskGrabber::open(), vpVideoReader::open(), vpV4l2Grabber::open(), vp1394TwoGrabber::setVideoMode(), setWidth(), vpV4l2Grabber::setWidth(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpOpenCVGrabber(), and vpV4l2Grabber::vpV4l2Grabber().