Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpFlyCaptureGrabber.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: Class which enables to project an image in the 3D space
32 * and get the view of a virtual camera.
33 *
34*****************************************************************************/
35
36#ifndef _vpFlyCaptureGrabber_h_
37#define _vpFlyCaptureGrabber_h_
38
39#include <ostream>
40#include <visp3/core/vpConfig.h>
41#include <visp3/core/vpFrameGrabber.h>
42
43#ifdef VISP_HAVE_FLYCAPTURE
44
45#include <FlyCapture2.h>
46
152class VISP_EXPORT vpFlyCaptureGrabber : public vpFrameGrabber
153{
154public:
156 virtual ~vpFlyCaptureGrabber();
157
159 void acquire(vpImage<unsigned char> &I, FlyCapture2::TimeStamp &timestamp);
160 void acquire(vpImage<vpRGBa> &I);
161 void acquire(vpImage<vpRGBa> &I, FlyCapture2::TimeStamp &timestamp);
162
163 void close();
164 void connect();
165 void disconnect();
166
167 float getBrightness();
168 std::ostream &getCameraInfo(std::ostream &os); // Cannot be const since
169 // FlyCapture2::Camera::GetCameraInfo()
170 // isn't
171 FlyCapture2::Camera *getCameraHandler();
173 unsigned int getCameraIndex() const { return m_index; };
174 bool getCameraPower();
175 static unsigned int getCameraSerial(unsigned int index);
176 float getExposure();
177 float getFrameRate();
178 float getGain();
179 static unsigned int getNumCameras();
180 unsigned int getSharpness();
181 float getShutter();
182
183 bool isCameraPowerAvailable();
185 bool isConnected() const { return m_connected; }
187 bool isCaptureStarted() const { return m_capture; }
188 bool isFormat7Supported(FlyCapture2::Mode format7_mode);
189 bool isVideoModeAndFrameRateSupported(FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate);
191 void open(vpImage<vpRGBa> &I);
192
194 vpFlyCaptureGrabber &operator>>(vpImage<vpRGBa> &I);
195
196 float setBrightness(bool brightness_auto, float brightness_value = 0);
197 void setCameraIndex(unsigned int index);
198 void setCameraPower(bool on);
199 void setCameraSerial(unsigned int serial);
200 float setExposure(bool exposure_on, bool exposure_auto, float exposure_value = 0);
201 float setGain(bool gain_auto, float gain_value = 0);
202 void setFormat7VideoMode(FlyCapture2::Mode format7_mode, FlyCapture2::PixelFormat pixel_format, unsigned int width,
203 unsigned int height);
204 float setFrameRate(float frame_rate);
205 unsigned int setSharpness(bool sharpness_on, bool sharpness_auto, unsigned int sharpness_value = 0);
206 float setShutter(bool auto_shutter, float shutter_ms = 10);
207 void setVideoModeAndFrameRate(FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate);
208
209 void startCapture();
210 void stopCapture();
211
212protected:
213 typedef enum {
216 } PropertyValue;
217 std::pair<unsigned int, unsigned int> centerRoi(unsigned int size, unsigned int max_size, unsigned int step);
218 FlyCapture2::Property getProperty(FlyCapture2::PropertyType prop_type);
219 FlyCapture2::PropertyInfo getPropertyInfo(FlyCapture2::PropertyType prop_type);
220 void open();
221 void setProperty(const FlyCapture2::PropertyType &prop_type, bool on, bool auto_on, float value,
222 PropertyValue prop_value = ABS_VALUE);
223
224protected:
225 FlyCapture2::Camera m_camera;
226 FlyCapture2::PGRGuid m_guid;
227 unsigned int m_index;
228 unsigned int m_numCameras;
229 FlyCapture2::Image m_rawImage;
232};
233
234#endif
235#endif
FlyCapture2::Image m_rawImage
Image buffer.
bool m_capture
true is capture started
bool isCaptureStarted() const
Return true if the camera capture is started.
FlyCapture2::Camera m_camera
Pointer to each camera.
unsigned int m_index
Active camera index.
unsigned int m_numCameras
Number of connected cameras.
@ VALUE_A
Consider FlyCapture2::Property::valueA.
@ ABS_VALUE
Consider FlyCapture2::Property::absValue.
bool m_connected
true if camera connected
FlyCapture2::PGRGuid m_guid
Active camera guid.
unsigned int getCameraIndex() const
bool isConnected() const
Return true if the camera is connected.
Base class for all video devices. It is designed to provide a front end to video sources.
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