Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vp1394CMUGrabber.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See https://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
33 *
34 * Authors:
35 * Lucas Lopes Lemos FEMTO-ST, AS2M departement, Besancon
36 * Guillaume Laurent FEMTO-ST, AS2M departement, Besancon
37 *
38*****************************************************************************/
39
40#ifndef vp1394CMUGrabber_h
41#define vp1394CMUGrabber_h
42
43#include <visp3/core/vpConfig.h>
44
45#ifdef VISP_HAVE_CMU1394
46
47// Include WinSock2.h before windows.h to ensure that winsock.h is not
48// included by windows.h since winsock.h and winsock2.h are incompatible
49#include <1394Camera.h> // CMU library
50#include <WinSock2.h>
51#include <windows.h>
52
53#include <visp3/core/vpFrameGrabber.h>
54#include <visp3/core/vpFrameGrabberException.h>
55#include <visp3/core/vpImage.h>
56#include <visp3/core/vpRGBa.h>
57
62
149
150class VISP_EXPORT vp1394CMUGrabber : public vpFrameGrabber
151{
152public:
156 typedef enum { YUV444, YUV422, YUV411, RGB8, MONO8, MONO16, UNKNOWN } vpColorCodingType;
157
158private:
160 C1394Camera *camera;
162 int index;
164 unsigned long _format;
166 unsigned long _mode;
168 unsigned long _fps;
170 bool _modeauto;
172 unsigned short _gain;
174 unsigned short _shutter;
176 vpColorCodingType _color;
177
178public:
179 // Constructor.
181 // Destructor.
182 virtual ~vp1394CMUGrabber();
183
184 // Acquire one frame in a greyscale image.
186
187 // Acquire one frame in a color image.
188 void acquire(vpImage<vpRGBa> &I);
189
190 // Stop the acquisition.
191 void close();
192
193 // Display information about the camera on the standard output.
194 void displayCameraDescription(int cam_id);
195
196 // Display camera model on the standard output. Call it after open the
197 // grabber.
198 void displayCameraModel();
199
200 // Get the video framerate
201 int getFramerate();
202
203 // Get the gain min and max values.
204 void getGainMinMax(unsigned short &min, unsigned short &max);
205
206 // Get the number of connected cameras.
207 int getNumberOfConnectedCameras() const;
208
209 // Get the shutter min and max values.
210 void getShutterMinMax(unsigned short &min, unsigned short &max);
211
214 {
216 if (_format == 0) {
217 switch (_mode) {
218 case 0:
220 break;
221 case 1:
223 break;
224 case 2:
226 break;
227 case 3:
229 break;
230 case 4:
232 break;
233 case 5:
235 break;
236 case 6:
238 break;
239 }
240 } else if (_format == 1) {
241 switch (_mode) {
242 case 0:
244 break;
245 case 1:
247 break;
248 case 2:
250 break;
251 case 3:
253 break;
254 case 4:
256 break;
257 case 5:
259 break;
260 case 6:
262 break;
263 case 7:
265 break;
266 }
267 } else if (_format == 2) {
268 switch (_mode) {
269 case 0:
271 break;
272 case 1:
274 break;
275 case 2:
277 break;
278 case 3:
280 break;
281 case 4:
283 break;
284 case 5:
286 break;
287 case 6:
289 break;
290 case 7:
292 break;
293 }
294 }
295
296 return color;
297 }
298
299 // Initialization of the grabber using a greyscale image.
301
302 // Initialization of the grabber using a color image.
303 void open(vpImage<vpRGBa> &I);
304
306 vp1394CMUGrabber &operator>>(vpImage<vpRGBa> &I);
307
308 // Select the camera on the bus. Call it before open the grabber.
309 void selectCamera(int cam_id);
310
311 // Enable auto gain
312 void setAutoGain();
313
314 // Enable auto shutter
315 void setAutoShutter();
316
317 // Set the gain and the shutter values. Call it before open the grabber
318 void setControl(unsigned short gain, unsigned short shutter);
319
320 // Set the frame rate. Call it before open the grabber.
321 void setFramerate(unsigned long fps);
322
323 // Set the shutter value. Call it before open the grabber
324 void setShutter(unsigned short shutter);
325
326 // Set the gain value. Call it before open the grabber
327 void setGain(unsigned short gain);
328
329 // Set the video format and mode. Call it before open the grabber.
330 void setVideoMode(unsigned long format, unsigned long mode);
331
332private:
333 void initCamera();
334};
335
336#endif
337#endif
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
vpColorCodingType getVideoColorCoding() const
Get the video color coding format.
virtual void open(vpImage< unsigned char > &I)=0
virtual void acquire(vpImage< unsigned char > &I)=0
virtual void close()=0
Definition of the vpImage class member functions.
Definition vpImage.h:135