Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpFlyCaptureGrabber.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: Class which enables to project an image in the 3D space
31 * and get the view of a virtual camera.
32 */
33
39
40#ifndef _vpFlyCaptureGrabber_h_
41#define _vpFlyCaptureGrabber_h_
42
43#include <ostream>
44#include <visp3/core/vpConfig.h>
45#include <visp3/core/vpFrameGrabber.h>
46
47#ifdef VISP_HAVE_FLYCAPTURE
48
49#include <FlyCapture2.h>
50
52
162class VISP_EXPORT vpFlyCaptureGrabber : public vpFrameGrabber
163{
164public:
166 virtual ~vpFlyCaptureGrabber();
167
169 void acquire(vpImage<unsigned char> &I, FlyCapture2::TimeStamp &timestamp);
170 void acquire(vpImage<vpRGBa> &I);
171 void acquire(vpImage<vpRGBa> &I, FlyCapture2::TimeStamp &timestamp);
172
173 void close();
174 void connect();
175 void disconnect();
176
177 float getBrightness();
178 std::ostream &getCameraInfo(std::ostream &os); // Cannot be const since
179 // FlyCapture2::Camera::GetCameraInfo()
180 // isn't
181 FlyCapture2::Camera *getCameraHandler();
183 unsigned int getCameraIndex() const { return m_index; }
184 bool getCameraPower();
185 static unsigned int getCameraSerial(unsigned int index);
186 float getExposure();
187 float getFrameRate();
188 float getGain();
189 static unsigned int getNumCameras();
190 unsigned int getSharpness();
191 float getShutter();
192
193 bool isCameraPowerAvailable();
195 bool isConnected() const { return m_connected; }
197 bool isCaptureStarted() const { return m_capture; }
198 bool isFormat7Supported(FlyCapture2::Mode format7_mode);
199 bool isVideoModeAndFrameRateSupported(FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate);
201 void open(vpImage<vpRGBa> &I);
202
204 vpFlyCaptureGrabber &operator>>(vpImage<vpRGBa> &I);
205
206 float setBrightness(bool brightness_auto, float brightness_value = 0);
207 void setCameraIndex(unsigned int index);
208 void setCameraPower(bool on);
209 void setCameraSerial(unsigned int serial);
210 float setExposure(bool exposure_on, bool exposure_auto, float exposure_value = 0);
211 float setGain(bool gain_auto, float gain_value = 0);
212 void setFormat7VideoMode(FlyCapture2::Mode format7_mode, FlyCapture2::PixelFormat pixel_format, unsigned int width,
213 unsigned int height);
214 float setFrameRate(float frame_rate);
215 unsigned int setSharpness(bool sharpness_on, bool sharpness_auto, unsigned int sharpness_value = 0);
216 float setShutter(bool auto_shutter, float shutter_ms = 10);
217 void setVideoModeAndFrameRate(FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate);
218
219 void startCapture();
220 void stopCapture();
221
222protected:
223 typedef enum
224 {
227 } PropertyValue;
228 std::pair<unsigned int, unsigned int> centerRoi(unsigned int size, unsigned int max_size, unsigned int step);
229 FlyCapture2::Property getProperty(FlyCapture2::PropertyType prop_type);
230 FlyCapture2::PropertyInfo getPropertyInfo(FlyCapture2::PropertyType prop_type);
231 void open();
232 void setProperty(const FlyCapture2::PropertyType &prop_type, bool on, bool auto_on, float value,
233 PropertyValue prop_value = ABS_VALUE);
234
235protected:
236 FlyCapture2::Camera m_camera;
237 FlyCapture2::PGRGuid m_guid;
238 unsigned int m_index;
239 unsigned int m_numCameras;
240 FlyCapture2::Image m_rawImage;
243};
244END_VISP_NAMESPACE
245#endif
246#endif
FlyCapture2::Camera * getCameraHandler()
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.
std::ostream & getCameraInfo(std::ostream &os)
@ 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.
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