Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vp1394CMUGrabber.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
32 */
33
38
39#ifndef VP_1394_CMU_GRABBER_H
40#define VP_1394_CMU_GRABBER_H
41
42#include <visp3/core/vpConfig.h>
43
44#ifdef VISP_HAVE_CMU1394
45
46// Include WinSock2.h before windows.h to ensure that winsock.h is not
47// included by windows.h since winsock.h and winsock2.h are incompatible
48#include <1394Camera.h> // CMU library
49
50// Mute warning with clang-cl
51// warning : non-portable path to file '<WinSock2.h>'; specified path differs in case from file name on disk [-Wnonportable-system-include-path]
52// warning : non-portable path to file '<Windows.h>'; specified path differs in case from file name on disk [-Wnonportable-system-include-path]
53#if defined(__clang__)
54# pragma clang diagnostic push
55# pragma clang diagnostic ignored "-Wnonportable-system-include-path"
56#endif
57
58#include <WinSock2.h>
59#include <windows.h>
60
61#if defined(__clang__)
62# pragma clang diagnostic pop
63#endif
64
65#include <visp3/core/vpFrameGrabber.h>
66#include <visp3/core/vpFrameGrabberException.h>
67#include <visp3/core/vpImage.h>
68#include <visp3/core/vpRGBa.h>
69
161
162class VISP_EXPORT vp1394CMUGrabber : public vpFrameGrabber
163{
164public:
168 typedef enum { YUV444, YUV422, YUV411, RGB8, MONO8, MONO16, UNKNOWN } vpColorCodingType;
169
170private:
172 C1394Camera *camera;
174 int index;
176 unsigned long _format;
178 unsigned long _mode;
180 unsigned long _fps;
182 bool _modeauto;
184 unsigned short _gain;
186 unsigned short _shutter;
188 vpColorCodingType _color;
189
190public:
191 // Constructor.
193 // Destructor.
194 virtual ~vp1394CMUGrabber();
195
196 // Acquire one frame in a greyscale image.
198
199 // Acquire one frame in a color image.
200 void acquire(vpImage<vpRGBa> &I);
201
202 // Stop the acquisition.
203 void close();
204
205 // Display information about the camera on the standard output.
206 void displayCameraDescription(int cam_id);
207
208 // Display camera model on the standard output. Call it after open the
209 // grabber.
210 void displayCameraModel();
211
212 // Get the video framerate
213 int getFramerate();
214
215 // Get the gain min and max values.
216 void getGainMinMax(unsigned short &min, unsigned short &max);
217
218 // Get the number of connected cameras.
219 int getNumberOfConnectedCameras() const;
220
221 // Get the shutter min and max values.
222 void getShutterMinMax(unsigned short &min, unsigned short &max);
223
226 {
228 if (_format == 0) {
229 switch (_mode) {
230 case 0:
232 break;
233 case 1:
235 break;
236 case 2:
238 break;
239 case 3:
241 break;
242 case 4:
244 break;
245 case 5:
247 break;
248 case 6:
250 break;
251 }
252 }
253 else if (_format == 1) {
254 switch (_mode) {
255 case 0:
257 break;
258 case 1:
260 break;
261 case 2:
263 break;
264 case 3:
266 break;
267 case 4:
269 break;
270 case 5:
272 break;
273 case 6:
275 break;
276 case 7:
278 break;
279 }
280 }
281 else if (_format == 2) {
282 switch (_mode) {
283 case 0:
285 break;
286 case 1:
288 break;
289 case 2:
291 break;
292 case 3:
294 break;
295 case 4:
297 break;
298 case 5:
300 break;
301 case 6:
303 break;
304 case 7:
306 break;
307 }
308 }
309
310 return color;
311 }
312
313 // Initialization of the grabber using a greyscale image.
315
316 // Initialization of the grabber using a color image.
317 void open(vpImage<vpRGBa> &I);
318
320 vp1394CMUGrabber &operator>>(vpImage<vpRGBa> &I);
321
322 // Select the camera on the bus. Call it before open the grabber.
323 void selectCamera(int cam_id);
324
325 // Enable auto gain
326 void setAutoGain();
327
328 // Enable auto shutter
329 void setAutoShutter();
330
331 // Set the gain and the shutter values. Call it before open the grabber
332 void setControl(unsigned short gain, unsigned short shutter);
333
334 // Set the frame rate. Call it before open the grabber.
335 void setFramerate(unsigned long fps);
336
337 // Set the shutter value. Call it before open the grabber
338 void setShutter(unsigned short shutter);
339
340 // Set the gain value. Call it before open the grabber
341 void setGain(unsigned short gain);
342
343 // Set the video format and mode. Call it before open the grabber.
344 void setVideoMode(unsigned long format, unsigned long mode);
345
346private:
347 void initCamera();
348};
349END_VISP_NAMESPACE
350#endif
351#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:131