ViSP
2.9.0
|
#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 available in tutorial-grabber-opencv.cpp shows how to grab and display images using OpenCV wrappers impremented in ViSP.
Note that it is also possible to grab images using OpenCV library by using directly OpenCV cv::VideoCapture class. The following code corresponding to tutorial-grabber-opencv-bis.cpp shows how to grab images in a cv::Mat structure and then convert OpenCV images in ViSP images.
An other example very close to the previous one available in grabOpenCV-2.cpp shows how to grab images in OpenCV IplImage structure and then how to convert OpenCV images in ViSP images.
Definition at line 88 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 76 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 140 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 164 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 188 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 207 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 221 of file vpOpenCVGrabber.cpp.
|
inlineinherited |
Return the number of rows in the image.
Definition at line 119 of file vpFrameGrabber.h.
|
inlineinherited |
Return the number of columns in the image.
Definition at line 121 of file vpFrameGrabber.h.
void vpOpenCVGrabber::open | ( | ) |
Generic initialization of the grabber.
Definition at line 85 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 112 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 126 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 299 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 319 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 233 of file vpOpenCVGrabber.cpp.
void vpOpenCVGrabber::setHeight | ( | const unsigned int | h | ) |
Sets the captured image height.
h | : The requested value of the captured image height. |
vpFrameGrabberException::initializationError | If no camera was found. |
Definition at line 272 of file vpOpenCVGrabber.cpp.
References close(), vpFrameGrabber::height, vpFrameGrabberException::initializationError, and vpERROR_TRACE.
void vpOpenCVGrabber::setWidth | ( | const unsigned int | w | ) |
Sets the captured image width.
w | : The requested value of the captured image width. |
vpFrameGrabberException::initializationError | If no camera was found. |
Definition at line 249 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(), vp1394TwoGrabber::getHeight(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpVideoReader::open(), vp1394CMUGrabber::open(), vp1394TwoGrabber::setFormat7ROI(), setHeight(), vpV4l2Grabber::setHeight(), vp1394CMUGrabber::setVideoMode(), 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(), vpV4l2Grabber::acquire(), close(), vp1394CMUGrabber::close(), vp1394TwoGrabber::close(), open(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vp1394TwoGrabber::resetBus(), vp1394CMUGrabber::vp1394CMUGrabber(), 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(), vp1394TwoGrabber::getWidth(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpVideoReader::open(), vp1394CMUGrabber::open(), vp1394TwoGrabber::setFormat7ROI(), vp1394CMUGrabber::setVideoMode(), vp1394TwoGrabber::setVideoMode(), setWidth(), vpV4l2Grabber::setWidth(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpOpenCVGrabber(), and vpV4l2Grabber::vpV4l2Grabber().