/usr/include/visp/vp1394CMUGrabber.h is in libvisp-dev 2.8.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /****************************************************************************
*
* $Id: vp1394CMUGrabber.h 4216 2013-04-17 09:06:18Z fspindle $
*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.txt at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using ViSP with software that can not be combined with the GNU
* GPL, please contact INRIA about acquiring a ViSP Professional
* Edition License.
*
* See http://www.irisa.fr/lagadic/visp/visp.html for more information.
*
* This software was developed at:
* INRIA Rennes - Bretagne Atlantique
* Campus Universitaire de Beaulieu
* 35042 Rennes Cedex
* France
* http://www.irisa.fr/lagadic
*
* If you have questions regarding the use of this file, please contact
* INRIA at visp@inria.fr
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* Description:
* Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
*
* Authors:
* Lucas Lopes Lemos FEMTO-ST, AS2M departement, Besancon
* Guillaume Laurent FEMTO-ST, AS2M departement, Besancon
* Fabien Spindler
*
*****************************************************************************/
#ifndef vp1394CMUGrabber_h
#define vp1394CMUGrabber_h
#include <visp/vpConfig.h>
#ifdef VISP_HAVE_CMU1394
#include <windows.h>
#include <1394Camera.h> // CMU library
#include <visp/vpImage.h>
#include <visp/vpFrameGrabber.h>
#include <visp/vpFrameGrabberException.h>
#include <visp/vpRGBa.h>
/*!
\file vp1394CMUGrabber.h
\brief Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
*/
/*!
\class vp1394CMUGrabber
\ingroup Framegrabber CameraDriver
\brief Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
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 tutorial-grabber-CMU1394.cpp
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.
\code
#include <iostream>
#include <visp/vpImage.h>
#include <visp/vpDisplayOpenCV.h>
#include <visp/vp1394CMUGrabber.h>
int main()
{
#if defined(VISP_HAVE_CMU1394)
std::cout << "ViSP Image acquisition example" << std::endl;
vpImage<unsigned char> I;
vp1394CMUGrabber g;
if( g.getNumberOfConnectedCameras() > 1 )
std::cout << "There are " << g.getNumberOfConnectedCameras() << " connected cameras." << std::endl;
if( g.getNumberOfConnectedCameras() == 1 )
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.selectCamera(0);
g.setGain(0);
g.setShutter(2000);
g.setFramerate(3); // 15 FPS
g.setVideoMode(0, 5); // 640x480 - MONO
g.acquire(I);
// Display camera description
g.displayCameraDescription(0);
g.displayCameraModel();
std::cout << "Height: " << g.getHeight() << " Width: " << g.getWidth() << std::endl;
vpDisplayOpenCV d(I);
vpDisplay::display(I);
for(;;)
{
g.acquire(I);
vpDisplay::display(I);
vpDisplay::flush(I);
if (vpDisplay::getClick(I, false)) // a click to exit
break;
}
g.close();
#endif
std::cout << "ViSP exiting..." <<std::endl;
return 0;
}
\endcode
*/
class VISP_EXPORT vp1394CMUGrabber : public vpFrameGrabber
{
public:
/*!
Enumeration of color codings.
*/
typedef enum {
YUV444,
YUV422,
YUV411,
RGB8,
MONO8,
MONO16,
UNKNOWN
} vpColorCodingType;
private :
//! Current camera handle
C1394Camera *camera;
//! Camera index on the bus
int index;
//! Current video format
unsigned long _format;
//! Current video mode
unsigned long _mode ;
//! Current video frame rate
unsigned long _fps ;
//! Current auto mode
bool _modeauto;
//! Current gain
unsigned short _gain;
//! Current shutter
unsigned short _shutter;
//! Color coding
vpColorCodingType _color;
public:
// Constructor.
vp1394CMUGrabber();
// Destructor.
virtual ~vp1394CMUGrabber();
// Acquire one frame in a greyscale image.
void acquire(vpImage<unsigned char> &I);
// Acquire one frame in a color image.
void acquire(vpImage<vpRGBa> &I);
// Stop the acquisition.
void close();
// Display information about the camera on the standard output.
void displayCameraDescription(int cam_id);
// Display camera model on the standard output. Call it after open the grabber.
void displayCameraModel();
// Get the video framerate
int getFramerate();
// Get the gain min and max values.
void getGainMinMax(unsigned short &min, unsigned short &max);
// Get the number of connected cameras.
int getNumberOfConnectedCameras() const ;
// Get the shutter min and max values.
void getShutterMinMax(unsigned short &min, unsigned short &max);
//! Get the video color coding format.
vpColorCodingType getVideoColorCoding() const
{
vpColorCodingType color = vp1394CMUGrabber::UNKNOWN;
if (_format == 0)
{
switch(_mode)
{
case 0: color = vp1394CMUGrabber::YUV444; break;
case 1: color = vp1394CMUGrabber::YUV422; break;
case 2: color = vp1394CMUGrabber::YUV411; break;
case 3: color = vp1394CMUGrabber::YUV422; break;
case 4: color = vp1394CMUGrabber::RGB8; break;
case 5: color = vp1394CMUGrabber::MONO8; break;
case 6: color = vp1394CMUGrabber::MONO16; break;
}
}
else if (_format == 1)
{
switch(_mode)
{
case 0: color = vp1394CMUGrabber::YUV422; break;
case 1: color = vp1394CMUGrabber::RGB8; break;
case 2: color = vp1394CMUGrabber::MONO8; break;
case 3: color = vp1394CMUGrabber::YUV422; break;
case 4: color = vp1394CMUGrabber::RGB8; break;
case 5: color = vp1394CMUGrabber::MONO8; break;
case 6: color = vp1394CMUGrabber::MONO16; break;
case 7: color = vp1394CMUGrabber::MONO16; break;
}
}
else if (_format == 2)
{
switch(_mode)
{
case 0: color = vp1394CMUGrabber::YUV422; break;
case 1: color = vp1394CMUGrabber::RGB8; break;
case 2: color = vp1394CMUGrabber::MONO8; break;
case 3: color = vp1394CMUGrabber::YUV422; break;
case 4: color = vp1394CMUGrabber::RGB8; break;
case 5: color = vp1394CMUGrabber::MONO8; break;
case 6: color = vp1394CMUGrabber::MONO16; break;
case 7: color = vp1394CMUGrabber::MONO16; break;
}
}
return color;
}
// Initialization of the grabber using a greyscale image.
void open(vpImage<unsigned char> &I);
// Initialization of the grabber using a color image.
void open(vpImage<vpRGBa> &I);
// Select the camera on the bus. Call it before open the grabber.
void selectCamera(int cam_id);
// Enable auto gain
void setAutoGain();
// Enable auto shutter
void setAutoShutter();
// Set the gain and the shutter values. Call it before open the grabber
void setControl(unsigned short gain, unsigned short shutter);
// Set the frame rate. Call it before open the grabber.
void setFramerate(unsigned long fps);
// Set the shutter value. Call it before open the grabber
void setShutter(unsigned short shutter);
// Set the gain value. Call it before open the grabber
void setGain(unsigned short gain);
// Set the video format and mode. Call it before open the grabber.
void setVideoMode(unsigned long format, unsigned long mode );
private :
void initCamera();
};
#endif
#endif
|