Visual Servoing Platform  version 3.3.0
vp1394CMUGrabber Class Reference

#include <vp1394CMUGrabber.h>

+ Inheritance diagram for vp1394CMUGrabber:

Public Types

enum  vpColorCodingType {
  YUV444, YUV422, YUV411, RGB8,
  MONO8, MONO16, UNKNOWN
}
 

Public Member Functions

 vp1394CMUGrabber ()
 
virtual ~vp1394CMUGrabber ()
 
void acquire (vpImage< unsigned char > &I)
 
void acquire (vpImage< vpRGBa > &I)
 
void close ()
 
void displayCameraDescription (int cam_id)
 
void displayCameraModel ()
 
int getFramerate ()
 
void getGainMinMax (unsigned short &min, unsigned short &max)
 
int getNumberOfConnectedCameras () const
 
void getShutterMinMax (unsigned short &min, unsigned short &max)
 
vpColorCodingType getVideoColorCoding () const
 
void open (vpImage< unsigned char > &I)
 
void open (vpImage< vpRGBa > &I)
 
vp1394CMUGrabberoperator>> (vpImage< unsigned char > &I)
 
vp1394CMUGrabberoperator>> (vpImage< vpRGBa > &I)
 
void selectCamera (int cam_id)
 
void setAutoGain ()
 
void setAutoShutter ()
 
void setControl (unsigned short gain, unsigned short shutter)
 
void setFramerate (unsigned long fps)
 
void setShutter (unsigned short shutter)
 
void setGain (unsigned short gain)
 
void setVideoMode (unsigned long format, unsigned long mode)
 
Inherited functionalities from vpFramegrabber
unsigned int getHeight () const
 
unsigned int getWidth () const
 

Public Attributes

bool init
 

Protected Attributes

unsigned int height
 
unsigned int width
 

Detailed Description

Firewire cameras video capture based on CMU 1394 Digital Camera SDK.

Thus to be enabled, this class needs the optional CMU 1394 3rd party. Installation instruction are provided here https://visp.inria.fr/3rd_cmu1394.

This block is based on the CMU 1394 Digital Camera SDK. The CMU 1394 Digital Camera Driver must be installed (go to http://www.cs.cmu.edu/~iwan/1394/index.html to download it).

  • Parameters:
    • Camera index (0, 1, 2, ... or 10). First camera has index 0.
    • Image format
    • Frame rate. Real frame rate depends on device capacities.
    • Control : shutter speed and gain can be internally set, but it is possible to set manually them. Exposure time register value. Real exposure time depends on device capacities. Gain register value. Real gain depends on device capacities.

This first example available in tutorial-grabber-CMU1394.cpp shows how to grab and display images from a firewire camera under Windows.

#include <visp3/core/vpImage.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/sensor/vp1394CMUGrabber.h>
int main()
{
#ifdef VISP_HAVE_CMU1394
try {
g.setVideoMode(0, 1); // 640x480 MONO8
g.setFramerate(4); // 30 fps
g.open(I);
std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
#ifdef VISP_HAVE_GDI
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
while (1) {
g.acquire(I);
if (vpDisplay::getClick(I, false)) // A click to exit
break;
}
} catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
}
#else
std::cout << "Install CMU1394 SDK, configure and build ViSP again to use this example" << std::endl;
#endif
}

This other example shows how to consider more than one firewire camera, and how to grab and display images from the first camera found on the bus.

#include <iostream>
#include <visp3/core/vpImage.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/sensor/vp1394CMUGrabber.h>
int main()
{
#if defined(VISP_HAVE_CMU1394)
std::cout << "ViSP Image acquisition example" << std::endl;
std::cout << "There are " << g.getNumberOfConnectedCameras() << " connected cameras." << std::endl;
std::cout << "There is " << g.getNumberOfConnectedCameras() << " connected camera." << std::endl;
else
std::cout << "There is no connected camera." << std::endl;
// Setting camera parameters manually
g.setGain(0);
g.setShutter(2000);
g.setFramerate(3); // 15 FPS
g.setVideoMode(0, 5); // 640x480 - MONO
g.acquire(I);
// Display camera description
std::cout << "Height: " << g.getHeight() << " Width: " << g.getWidth() << std::endl;
for(;;)
{
g.acquire(I);
if (vpDisplay::getClick(I, false)) // a click to exit
break;
}
g.close();
#endif
std::cout << "ViSP exiting..." <<std::endl;
return 0;
}
Examples
grab1394CMU.cpp, servoPioneerPanSegment3D.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, tutorial-apriltag-detector-live.cpp, tutorial-blob-tracker-live-firewire.cpp, tutorial-grabber-CMU1394.cpp, tutorial-mb-generic-tracker-live.cpp, tutorial-me-ellipse-tracker.cpp, tutorial-me-line-tracker.cpp, and tutorial-pose-from-points-live.cpp.

Definition at line 150 of file vp1394CMUGrabber.h.

Member Enumeration Documentation

◆ vpColorCodingType

Enumeration of color codings.

Enumerator
YUV444 
YUV422 
YUV411 
RGB8 
MONO8 
MONO16 
UNKNOWN 

Definition at line 156 of file vp1394CMUGrabber.h.

Constructor & Destructor Documentation

◆ vp1394CMUGrabber()

vp1394CMUGrabber::vp1394CMUGrabber ( )

Basic constructor.

Definition at line 52 of file vp1394CMUGrabber.cpp.

◆ ~vp1394CMUGrabber()

vp1394CMUGrabber::~vp1394CMUGrabber ( )
virtual

Destructor.

Definition at line 70 of file vp1394CMUGrabber.cpp.

Member Function Documentation

◆ acquire() [1/2]

void vp1394CMUGrabber::acquire ( vpImage< unsigned char > &  I)
virtual

Grabs a grayscale image from the selected camera. If the camera color coding differs from vp1394CMUGrabber::MONO8, the acquired image is converted in a gray level image to match the requested format.

Parameters
I: Acquired gray level image.

Implements vpFrameGrabber.

Examples
grab1394CMU.cpp, servoPioneerPanSegment3D.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, and tutorial-grabber-CMU1394.cpp.

Definition at line 209 of file vp1394CMUGrabber.cpp.

◆ acquire() [2/2]

void vp1394CMUGrabber::acquire ( vpImage< vpRGBa > &  I)
virtual

Grabs a color image from the selected camera. Since the cameras are not able to grab RGBa color coding format, the acquired image is converted in a RGBa to match the requested format. This transformation could be time consuming.

Parameters
I: Acquired color image in RGBa format.

Implements vpFrameGrabber.

Definition at line 271 of file vp1394CMUGrabber.cpp.

◆ close()

void vp1394CMUGrabber::close ( )
virtual

Stop the acquisition of images and free the camera.

Implements vpFrameGrabber.

Definition at line 323 of file vp1394CMUGrabber.cpp.

◆ displayCameraDescription()

void vp1394CMUGrabber::displayCameraDescription ( int  cam_id)

Display information about the camera on the standard output.

Definition at line 486 of file vp1394CMUGrabber.cpp.

◆ displayCameraModel()

void vp1394CMUGrabber::displayCameraModel ( )

Display camera model on the standard output. Call it after open the grabber.

Definition at line 501 of file vp1394CMUGrabber.cpp.

◆ getFramerate()

int vp1394CMUGrabber::getFramerate ( )

Get the video framerate.

Returns
Value between 0 to 7 corresponding to a specific camera framerate. See the following table for the correspondances between the returned value and the framerate.
Value Frame rate
0 1.875 fps
1 3.75 fps
2 7.5 fps
3 15 fps
4 30 fps
5 60 fps
6 120 fps
7 240 fps
See also
setFramerate()
Examples
grab1394CMU.cpp.

Definition at line 706 of file vp1394CMUGrabber.cpp.

◆ getGainMinMax()

void vp1394CMUGrabber::getGainMinMax ( unsigned short &  min,
unsigned short &  max 
)

Get the gain min and max values.

See also
setAutoGain(), setGain()
Examples
grab1394CMU.cpp.

Definition at line 365 of file vp1394CMUGrabber.cpp.

◆ getHeight()

unsigned int vpFrameGrabber::getHeight ( ) const
inlineinherited

Return the number of rows in the image.

Examples
AROgre.cpp, AROgreBasic.cpp, and testPylonGrabber.cpp.

Definition at line 113 of file vpFrameGrabber.h.

◆ getNumberOfConnectedCameras()

int vp1394CMUGrabber::getNumberOfConnectedCameras ( ) const

Get the number of connected cameras.

Definition at line 353 of file vp1394CMUGrabber.cpp.

◆ getShutterMinMax()

void vp1394CMUGrabber::getShutterMinMax ( unsigned short &  min,
unsigned short &  max 
)

Get the shutter min and max values.

See also
setAutoShutter(), setShutter()
Examples
grab1394CMU.cpp.

Definition at line 426 of file vp1394CMUGrabber.cpp.

◆ getVideoColorCoding()

vpColorCodingType vp1394CMUGrabber::getVideoColorCoding ( ) const
inline

Get the video color coding format.

Definition at line 213 of file vp1394CMUGrabber.h.

◆ getWidth()

unsigned int vpFrameGrabber::getWidth ( ) const
inlineinherited

Return the number of columns in the image.

Examples
AROgre.cpp, AROgreBasic.cpp, and testPylonGrabber.cpp.

Definition at line 115 of file vpFrameGrabber.h.

◆ open() [1/2]

void vp1394CMUGrabber::open ( vpImage< unsigned char > &  I)
virtual

◆ open() [2/2]

void vp1394CMUGrabber::open ( vpImage< vpRGBa > &  I)
virtual

Initialization of the grabber using a color image.

Parameters
I: color image.

Implements vpFrameGrabber.

Definition at line 196 of file vp1394CMUGrabber.cpp.

◆ operator>>() [1/2]

vp1394CMUGrabber & vp1394CMUGrabber::operator>> ( vpImage< unsigned char > &  I)

Operator that allows to capture a grey level image.

Parameters
I: The captured image.
#include <visp3/sensor/vp1394CMUGrabber.h>
int main()
{
g >> I;
}

Definition at line 729 of file vp1394CMUGrabber.cpp.

◆ operator>>() [2/2]

vp1394CMUGrabber & vp1394CMUGrabber::operator>> ( vpImage< vpRGBa > &  I)

Operator that allows to capture a grey level image.

Parameters
I: The captured image.
#include <visp3/sensor/vp1394CMUGrabber.h>
int main()
{
g >> I;
}

Definition at line 751 of file vp1394CMUGrabber.cpp.

◆ selectCamera()

void vp1394CMUGrabber::selectCamera ( int  cam_id)

Select the camera on the bus from its index. The first camera found on the bus has index 0.

Parameters
cam_id: Camera index.

Definition at line 84 of file vp1394CMUGrabber.cpp.

◆ setAutoGain()

void vp1394CMUGrabber::setAutoGain ( )

Enable auto gain.

See also
setGain()
Examples
tutorial-grabber-CMU1394.cpp.

Definition at line 379 of file vp1394CMUGrabber.cpp.

◆ setAutoShutter()

void vp1394CMUGrabber::setAutoShutter ( )

Enable auto shutter.

See also
setShutter()
Examples
tutorial-grabber-CMU1394.cpp.

Definition at line 441 of file vp1394CMUGrabber.cpp.

◆ setControl()

void vp1394CMUGrabber::setControl ( unsigned short  gain,
unsigned short  shutter 
)

Set the gain and the shutter values.

See also
setGain(), setShutter()

Definition at line 344 of file vp1394CMUGrabber.cpp.

◆ setFramerate()

void vp1394CMUGrabber::setFramerate ( unsigned long  fps)

Set camera framerate rate. This method has to be called before open().

Parameters
fps: Value between 0 to 7 used to select a specific camera framerate. See the following table for the correspondances between the input value and the framerate.
Value Frame rate
0 1.875 fps
1 3.75 fps
2 7.5 fps
3 15 fps
4 30 fps
5 60 fps
6 120 fps
7 240 fps
See also
getFramerate()
Examples
grab1394CMU.cpp, servoPioneerPanSegment3D.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, and tutorial-grabber-CMU1394.cpp.

Definition at line 641 of file vp1394CMUGrabber.cpp.

◆ setGain()

void vp1394CMUGrabber::setGain ( unsigned short  gain)

Disable auto gain and set the gain to the requested value.

See also
setAutoGain()

Definition at line 389 of file vp1394CMUGrabber.cpp.

◆ setShutter()

void vp1394CMUGrabber::setShutter ( unsigned short  shutter)

Disable auto shutter and set the shutter to the requested value.

See also
setAutoShutter()

Definition at line 451 of file vp1394CMUGrabber.cpp.

◆ setVideoMode()

void vp1394CMUGrabber::setVideoMode ( unsigned long  format,
unsigned long  mode 
)

Set the camera format and video mode. This method has to be called before open().

Parameters
format: Camera video format.
mode: Camera video mode.

See the following table for the correspondances between the input format and mode and the resulting video color coding.

Format Mode (H) x (W) Color
0 0 160 x 120 YUV444
0 1 320 x 240 YUV422
0 2 640 x 480 YUV411
0 3 640 x 480 YUV422
0 4 640 x 480 RGB8
0 5 640 x 480 MONO8
0 6 640 x 480 MONO16
1 0 800 x 600 YUV422
1 1 800 x 600 RGB8
1 2 800 x 600 MONO8
1 3 1024 x 768 YUV422
1 4 1024 x 768 RGB8
1 5 1024 x 768 MONO8
1 6 800 x 600 MONO16
1 7 1024 x 768 MONO16
2 0 1280 x 960 YUV422
2 1 1280 x 960 RGB8
2 2 1280 x 960 MONO8
2 3 1600 x 1200YUV422
2 4 1600 x 1200RGB8
2 5 1600 x 1200MONO8
2 6 1280 x 960 MONO16
2 7 1600 x 1200MONO16
Examples
grab1394CMU.cpp, servoPioneerPanSegment3D.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, and tutorial-grabber-CMU1394.cpp.

Definition at line 556 of file vp1394CMUGrabber.cpp.

Member Data Documentation

◆ height

unsigned int vpFrameGrabber::height
protectedinherited

Number of rows in the image.

Definition at line 106 of file vpFrameGrabber.h.

Referenced by vpDirectShowGrabber::getFormat().

◆ init

bool vpFrameGrabber::init
inherited

Set to true if the frame grabber has been initialized.

Definition at line 103 of file vpFrameGrabber.h.

◆ width

unsigned int vpFrameGrabber::width
protectedinherited

Number of columns in the image.

Definition at line 107 of file vpFrameGrabber.h.

Referenced by vpDirectShowGrabber::getFormat().

vp1394CMUGrabber::setAutoShutter
void setAutoShutter()
Definition: vp1394CMUGrabber.cpp:441
vp1394CMUGrabber::close
void close()
Definition: vp1394CMUGrabber.cpp:323
vpFrameGrabber::getWidth
unsigned int getWidth() const
Return the number of columns in the image.
Definition: vpFrameGrabber.h:115
vp1394CMUGrabber::getNumberOfConnectedCameras
int getNumberOfConnectedCameras() const
Definition: vp1394CMUGrabber.cpp:353
vp1394CMUGrabber::setGain
void setGain(unsigned short gain)
Definition: vp1394CMUGrabber.cpp:389
vp1394CMUGrabber::setShutter
void setShutter(unsigned short shutter)
Definition: vp1394CMUGrabber.cpp:451
vp1394CMUGrabber::acquire
void acquire(vpImage< unsigned char > &I)
Definition: vp1394CMUGrabber.cpp:209
vp1394CMUGrabber::open
void open(vpImage< unsigned char > &I)
Definition: vp1394CMUGrabber.cpp:186
vp1394CMUGrabber::setAutoGain
void setAutoGain()
Definition: vp1394CMUGrabber.cpp:379
vp1394CMUGrabber
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
Definition: vp1394CMUGrabber.h:150
vp1394CMUGrabber::displayCameraModel
void displayCameraModel()
Definition: vp1394CMUGrabber.cpp:501
vp1394CMUGrabber::displayCameraDescription
void displayCameraDescription(int cam_id)
Definition: vp1394CMUGrabber.cpp:486
vpDisplayGDI
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:127
vp1394CMUGrabber::setVideoMode
void setVideoMode(unsigned long format, unsigned long mode)
Definition: vp1394CMUGrabber.cpp:556
vpDisplayOpenCV
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Definition: vpDisplayOpenCV.h:140
vpDisplay::display
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay_uchar.cpp:739
vpImage::getHeight
unsigned int getHeight() const
Definition: vpImage.h:221
vp1394CMUGrabber::selectCamera
void selectCamera(int cam_id)
Definition: vp1394CMUGrabber.cpp:84
vp1394CMUGrabber::setFramerate
void setFramerate(unsigned long fps)
Definition: vp1394CMUGrabber.cpp:641
vpDisplay::flush
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay_uchar.cpp:715
vpImage< unsigned char >
vpDisplay::getClick
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Definition: vpDisplay_uchar.cpp:764
vpFrameGrabber::getHeight
unsigned int getHeight() const
Return the number of rows in the image.
Definition: vpFrameGrabber.h:113
vpException
error that can be emited by ViSP classes.
Definition: vpException.h:70
vpImage::getWidth
unsigned int getWidth() const
Definition: vpImage.h:279