ViSP
2.8.0
|
#include <vp1394Grabber.h>
Public Types | |
enum | vp1394ImageFormatType { YUV444, YUV422, YUV411, RGB, RGBa, MONO, MONO16 } |
Public Member Functions | |
vp_deprecated | vp1394Grabber () |
vp_deprecated | vp1394Grabber (vpImage< unsigned char > &I) |
virtual | ~vp1394Grabber () |
void | setCamera (unsigned int camera) |
void | getCamera (unsigned int &camera) |
void | setFormat (int format) |
void | getFormat (int &format) |
int | getFormatSupported (vpList< int > &formats) |
void | setMode (int mode) |
void | getMode (int &mode) |
int | getModeSupported (int format, vpList< int > &modes) |
void | setFramerate (int framerate) |
void | getFramerate (int &framerate) |
int | getFramerateSupported (int format, int mode, vpList< int > &framerates) |
int | convertFormat (std::string format) |
int | convertMode (std::string mode) |
int | convertFramerate (std::string framerate) |
std::string | convertFormat (int format) |
std::string | convertMode (int mode) |
std::string | convertFramerate (int framerate) |
void | setShutter (unsigned int shutter) |
void | getShutter (unsigned int &min_shutter, unsigned int &shutter, unsigned int &max_shutter) |
void | setGain (unsigned int gain) |
void | getGain (unsigned int &min_gain, unsigned int &gain, unsigned int &max_gain) |
void | open (vpImage< unsigned char > &I) |
void | acquire (vpImage< unsigned char > &I) |
void | open (vpImage< vpRGBa > &I) |
void | acquire (vpImage< vpRGBa > &I) |
void | close () |
void | getWidth (unsigned int &width) |
void | getHeight (unsigned int &height) |
void | getNumCameras (unsigned int &cameras) |
unsigned int | getHeight () const |
unsigned int | getWidth () const |
Public Attributes | |
bool | init |
Static Public Attributes | |
static const int | DROP_FRAMES = 1 |
static const int | NUM_BUFFERS = 8 |
static const int | MAX_PORTS = 4 |
static const int | MAX_CAMERAS = 8 |
static const char * | strFormats [NUM_FORMATS] |
static const char * | strModesInFormat0 [NUM_FORMAT0_MODES] |
static const char * | strModesInFormat1 [NUM_FORMAT1_MODES] |
static const char * | strModesInFormat2 [NUM_FORMAT2_MODES] |
static const char * | strModesInFormat6 [NUM_FORMAT6_MODES] |
static const char * | strModesInFormat7 [NUM_MODE_FORMAT7] |
static const char * | strColorsInFormat7 [NUM_COLOR_FORMAT7] |
static const char * | strFramerates [NUM_FRAMERATES] |
Protected Attributes | |
unsigned int | height |
unsigned int | width |
Class for firewire ieee1394 video devices using libdc1394-1.x api.
Needs libraw1394-1.2.0 and libdc1394-1.1.0 or more recent versions available on http://sourceforge.net.
This class was tested with Marlin F033C and F131B cameras. This grabber is not working with a PointGrey DragonFly 2 camera. Since libdc1394-1.x is deprecated, you should better use vp1394TwoGrabber based on libdc1394-2.x.
The code below shows how to use this class.
Definition at line 123 of file vp1394Grabber.h.
Supported image coding format.
Definition at line 129 of file vp1394Grabber.h.
vp1394Grabber::vp1394Grabber | ( | ) |
Default constructor. Using this constructor, you have explicitly to call open().
By default:
Current camera settings can be changed using setCamera(), setFormat(), setMode() or setFramerate() after a call to open(). The list of supported formats, modes and framerates is available using respectively getFormatSupported(), getModeSupported(), getFramerateSupported().
Definition at line 172 of file vp1394Grabber.cpp.
References vpFrameGrabber::init, MAX_CAMERAS, and RGB.
vp1394Grabber::vp1394Grabber | ( | vpImage< unsigned char > & | I | ) |
Constructor which initialize the grabber and call the open() method.
I | : Image data structure (8 bits image) |
By default:
Current camera settings can be changed using setCamera(), setFormat(), setMode() or setFramerate() after a call to open(). The list of supported formats, modes and framerates is available using respectively getFormatSupported(), getModeSupported(), getFramerateSupported().
Definition at line 240 of file vp1394Grabber.cpp.
References vpFrameGrabber::init, MAX_CAMERAS, open(), and RGB.
|
virtual |
Destructor.
Stops the iso transmission and close the device.
Definition at line 290 of file vp1394Grabber.cpp.
References close().
|
virtual |
Acquire a grey level image from a given camera.
I | : Image data structure (8 bits image) |
vpFrameGrabberException::initializationError | : If the device is not openned. |
Implements vpFrameGrabber.
Definition at line 1601 of file vp1394Grabber.cpp.
References vpImage< Type >::bitmap, close(), vpFrameGrabber::getHeight(), vpImage< Type >::getHeight(), vpFrameGrabber::getWidth(), vpImage< Type >::getWidth(), vpFrameGrabber::init, vpFrameGrabberException::initializationError, MONO, vpFrameGrabberException::otherError, vpImage< Type >::resize(), RGB, RGBa, vpImageConvert::RGBaToGrey(), vpImageConvert::RGBToGrey(), YUV411, vpImageConvert::YUV411ToGrey(), YUV422, and vpImageConvert::YUV422ToGrey().
Acquire a color image from a given camera.
I | : Image data structure (RGBa image) |
vpFrameGrabberException::initializationError | : If the device is not openned. |
Implements vpFrameGrabber.
Definition at line 1664 of file vp1394Grabber.cpp.
References vpImage< Type >::bitmap, close(), vpFrameGrabber::getHeight(), vpImage< Type >::getHeight(), vpFrameGrabber::getWidth(), vpImage< Type >::getWidth(), vpImageConvert::GreyToRGBa(), vpFrameGrabber::init, vpFrameGrabberException::initializationError, MONO, vpFrameGrabberException::otherError, vpImage< Type >::resize(), RGB, RGBa, vpImageConvert::RGBToRGBa(), YUV411, vpImageConvert::YUV411ToRGBa(), YUV422, and vpImageConvert::YUV422ToRGBa().
|
virtual |
Close the link between the camera and the acquisition program
Implements vpFrameGrabber.
Definition at line 2306 of file vp1394Grabber.cpp.
Referenced by acquire(), getFormat(), getFormatSupported(), getFramerate(), getFramerateSupported(), getGain(), getHeight(), getMode(), getModeSupported(), getShutter(), getWidth(), setCamera(), setGain(), setShutter(), and ~vp1394Grabber().
int vp1394Grabber::convertFormat | ( | std::string | format | ) |
Converts the string containing the description of the format into the format dentifier.
format | : The string describing the format given by Format(int) |
Definition at line 911 of file vp1394Grabber.cpp.
std::string vp1394Grabber::convertFormat | ( | int | format | ) |
Converts the format identifier into a string containing the description of the format.
format | : The camera capture format, either :
|
Definition at line 1009 of file vp1394Grabber.cpp.
References strFormats.
int vp1394Grabber::convertFramerate | ( | std::string | framerate | ) |
Converts the string containing the description of the framerate into the framerate dentifier.
framerate | : The string describing the framerate given by Framerate(int). |
This method returns 0 if the string does not match to a framerate string.
Definition at line 980 of file vp1394Grabber.cpp.
std::string vp1394Grabber::convertFramerate | ( | int | framerate | ) |
Converts the framerate identifier into a string containing the description of the framerate.
framerate | : The camera capture framerate. |
Definition at line 1143 of file vp1394Grabber.cpp.
References strFramerates.
int vp1394Grabber::convertMode | ( | std::string | mode | ) |
Converts the string containing the description of the mode into the mode dentifier.
mode | : The string describing the mode given by Mode(int) |
This method returns 0 if the string does not match to a mode string.
Definition at line 936 of file vp1394Grabber.cpp.
std::string vp1394Grabber::convertMode | ( | int | mode | ) |
Converts the mode identifier into a string containing the description of the mode.
mode | : The camera capture mode. |
Definition at line 1049 of file vp1394Grabber.cpp.
References strColorsInFormat7, strModesInFormat0, strModesInFormat1, strModesInFormat2, strModesInFormat6, and strModesInFormat7.
void vp1394Grabber::getCamera | ( | unsigned int & | camera | ) |
Get the active camera on the bus.
camera | : A camera id. The value is comprised between 0 (the first camera) and the number of cameras found on the bus and returned by getNumCameras(). |
Definition at line 348 of file vp1394Grabber.cpp.
void vp1394Grabber::getFormat | ( | int & | format | ) |
Query the actual capture format of a given camera. The camera supported formats are given by getFormatSupported().
format | : The camera capture format (see file libdc1394/dc1394_control.h), either : |
vpFrameGrabberException::settingError | : If the required camera is not present or if an error occurs. |
Definition at line 421 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
Referenced by open().
int vp1394Grabber::getFormatSupported | ( | vpList< int > & | formats | ) |
Query the available camera image formats.
formats | : The list of supported camera image formats. |
vpFrameGrabberException::settingError | : If the required camera is not present or if an error occurs. |
Definition at line 466 of file vp1394Grabber.cpp.
References vpList< type >::addRight(), close(), vpList< type >::kill(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
void vp1394Grabber::getFramerate | ( | int & | framerate | ) |
Query the actual capture framerate of a given camera. The camera supported framerates are given by getFramerateSupported().
framerate | : The camera capture framerate. |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 783 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
Referenced by open().
int vp1394Grabber::getFramerateSupported | ( | int | format, |
int | mode, | ||
vpList< int > & | framerates | ||
) |
Query the available framerates for the given camera image format and mode (see file libdc1394/dc1394_control.h). The framerate is only available if format is either FORMAT_VGA_NONCOMPRESSED (format 0), FORMAT_SVGA_NONCOMPRESSED_1 (format 1) or FORMAT_SVGA_NONCOMPRESSED_2 (format 2). If format is equal to FORMAT_STILL_IMAGE (format 6) or FORMAT_SCALABLE_IMAGE_SIZE (format 7), the framerate is not available. In this case, we return 0.
format | : Camera image format. |
mode | : Camera mode. |
framerates | ; The list of supported camera framerates. |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 836 of file vp1394Grabber.cpp.
References vpList< type >::addRight(), close(), vpList< type >::kill(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
void vp1394Grabber::getGain | ( | unsigned int & | min_gain, |
unsigned int & | gain, | ||
unsigned int & | max_gain | ||
) |
Query the actual gain value of a given camera and the bounded gain values.
min_gain | : Minimal autorized gain value. |
gain | : The current camera gain value. This value is comprised between min_gain and max_gain. |
max_gain | : Maximal autorized gain value. |
vpFrameGrabberException::settingError | :If the required camera is not present or if an error occurs. |
Definition at line 1398 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
|
inlineinherited |
Return the number of rows in the image.
Definition at line 119 of file vpFrameGrabber.h.
void vp1394Grabber::getHeight | ( | unsigned int & | height | ) |
Get the image height. It depends on the camera format setFormat() and mode setMode(). The height of the images is only available after a call to open().
height | : The image height. |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 1493 of file vp1394Grabber.cpp.
References close(), vpFrameGrabber::height, and vpFrameGrabberException::settingError.
void vp1394Grabber::getMode | ( | int & | mode | ) |
Query the actual capture mode of a given camera. Given a format, all the camera supported modes are given by getModeSupported().
mode | : The camera capture mode. |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 588 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
Referenced by open().
int vp1394Grabber::getModeSupported | ( | int | format, |
vpList< int > & | modes | ||
) |
Query the available camera modes for the given format.
format | : Camera image format. Values for format are parts of the list (see file libdc1394/dc1394_control.h): |
modes | : The list of supported camera modes. |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 640 of file vp1394Grabber.cpp.
References vpList< type >::addRight(), close(), vpList< type >::kill(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
void vp1394Grabber::getNumCameras | ( | unsigned int & | cameras | ) |
Query the number of cameras on the bus.
cameras | : The number of cameras found on the bus. |
Definition at line 1515 of file vp1394Grabber.cpp.
References vpCTRACE.
void vp1394Grabber::getShutter | ( | unsigned int & | min_shutter, |
unsigned int & | shutter, | ||
unsigned int & | max_shutter | ||
) |
Query the actual shutter value of a given camera and the bounded shutter values.
min_shutter | : Minimal autorized shutter value. |
shutter | : The current camera shutter value. This value is comprised between min_shutter and max_shutter. |
max_shutter | : Maximal autorized shutter value. |
vpFrameGrabberException::settingError | : If the required camera is not present or if an error occurs. |
Definition at line 1260 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
|
inlineinherited |
Return the number of columns in the image.
Definition at line 121 of file vpFrameGrabber.h.
void vp1394Grabber::getWidth | ( | unsigned int & | width | ) |
Get the image width. It depends on the camera format setFormat() and mode setMode(). The width of the images is only available after a call to open().
width | : The image width, zero if the required camera is not available. |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 1464 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpFrameGrabber::width.
|
virtual |
Initialize grey level image acquisition
I | : Image data structure (8 bits image) |
Implements vpFrameGrabber.
Definition at line 1533 of file vp1394Grabber.cpp.
References getFormat(), getFramerate(), vpFrameGrabber::getHeight(), getMode(), vpFrameGrabber::getWidth(), vpFrameGrabber::init, open(), vpImage< Type >::resize(), and vpDEBUG_TRACE.
Referenced by open(), and vp1394Grabber().
Initialize color image (in RGBa format) acquisition
I | : Image data structure (RGBa format) |
Implements vpFrameGrabber.
Definition at line 1565 of file vp1394Grabber.cpp.
References getFormat(), getFramerate(), vpFrameGrabber::getHeight(), getMode(), vpFrameGrabber::getWidth(), vpFrameGrabber::init, open(), vpImage< Type >::resize(), and vpDEBUG_TRACE.
void vp1394Grabber::setCamera | ( | unsigned int | camera | ) |
If multiples cameras are connected on the bus, select the camero to dial with.
camera | : A camera. The value must be comprised between 0 (the first camera) and the number of cameras found on the bus and returned by getNumCameras(). If two cameras are connected on the bus, setting camera to one allows to communicate with the second one. |
vpFrameGrabberException::settingError | : If the required camera is not reachable. |
Definition at line 324 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, and vpERROR_TRACE.
void vp1394Grabber::setFormat | ( | int | format | ) |
Set the capture format for a given camera on the bus. To set the format for a specific camera, call setCamera() before.
format | : The camera image format. The current camera format is given by getFormat(). The camera supported formats are given by getFormatSupported(). The allowed values given in libdc1394/dc1394_control.h are:
|
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 380 of file vp1394Grabber.cpp.
void vp1394Grabber::setFramerate | ( | int | framerate | ) |
Set the capture framerate for a given camera on the bus.
framerate | : The camera framerate. The current framerate of the camera is given by getFramerate(). The camera supported framerates are given by getFramerateSupported(). The allowed values given in libdc1394/dc1394_control.h are: |
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 746 of file vp1394Grabber.cpp.
void vp1394Grabber::setGain | ( | unsigned int | gain | ) |
Set the gain for a given camera.
gain | The gain value to apply to the camera. |
vpFrameGrabberException::settingError | : If the required camera is not present or if an error occurs. |
Definition at line 1323 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, vpCERROR, and vpERROR_TRACE.
void vp1394Grabber::setMode | ( | int | mode | ) |
Set the camera capture mode for a given camera on the bus.
mode | : The camera capture mode. The current camera mode is given by getMode(). The camera supported modes are given by getSupportedModes(). The allowed values are given in libdc1394/dc1394_control.h file: |
All these modes are not supported by your camera. The camera supported modes are given by getModeSupported().
vpFrameGrabberException::settingError | : If the required camera is not present. |
Definition at line 554 of file vp1394Grabber.cpp.
void vp1394Grabber::setShutter | ( | unsigned int | shutter | ) |
Set the shutter for a given camera.
shutter | : The shutter value to apply to the camera. |
vpFrameGrabberException::settingError | : If the required camera is not present or if an error occurs. |
Definition at line 1183 of file vp1394Grabber.cpp.
References close(), vpFrameGrabberException::settingError, vpCERROR, and vpERROR_TRACE.
|
static |
With libdc1394-1.0.0 or more rencent versions, DROP_FRAMES has to be set to 1 in order to suppress the latency.
Definition at line 139 of file vp1394Grabber.h.
|
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(), getHeight(), vp1394TwoGrabber::getHeight(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpVideoReader::open(), vp1394CMUGrabber::open(), vpOpenCVGrabber::setHeight(), vpV4l2Grabber::setHeight(), vp1394CMUGrabber::setVideoMode(), vp1394TwoGrabber::setVideoMode(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpOpenCVGrabber::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 vpOpenCVGrabber::acquire(), acquire(), vpV4l2Grabber::acquire(), vpOpenCVGrabber::close(), vp1394CMUGrabber::close(), vp1394TwoGrabber::close(), vpOpenCVGrabber::open(), vpDiskGrabber::open(), open(), vpV4l2Grabber::open(), vp1394TwoGrabber::resetBus(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394Grabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpDiskGrabber::vpDiskGrabber(), vpOpenCVGrabber::vpOpenCVGrabber(), and vpV4l2Grabber::vpV4l2Grabber().
|
static |
Maximal number of cameras
Definition at line 142 of file vp1394Grabber.h.
Referenced by vp1394Grabber().
|
static |
Maximal number of ports
Definition at line 141 of file vp1394Grabber.h.
|
static |
Number of buffers
Definition at line 140 of file vp1394Grabber.h.
|
static |
Definition at line 150 of file vp1394Grabber.h.
Referenced by convertMode().
|
static |
Definition at line 144 of file vp1394Grabber.h.
Referenced by convertFormat().
|
static |
Definition at line 151 of file vp1394Grabber.h.
Referenced by convertFramerate().
|
static |
Definition at line 145 of file vp1394Grabber.h.
Referenced by convertMode().
|
static |
Definition at line 146 of file vp1394Grabber.h.
Referenced by convertMode().
|
static |
Definition at line 147 of file vp1394Grabber.h.
Referenced by convertMode().
|
static |
Definition at line 148 of file vp1394Grabber.h.
Referenced by convertMode().
|
static |
Definition at line 149 of file vp1394Grabber.h.
Referenced by convertMode().
|
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(), getWidth(), vp1394TwoGrabber::getWidth(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpVideoReader::open(), vp1394CMUGrabber::open(), vp1394CMUGrabber::setVideoMode(), vp1394TwoGrabber::setVideoMode(), vpOpenCVGrabber::setWidth(), vpV4l2Grabber::setWidth(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpOpenCVGrabber::vpOpenCVGrabber(), and vpV4l2Grabber::vpV4l2Grabber().