7#ifndef YARP_FAKEFRAMEGRABBER_FAKEFRAMEGRABBER_H
8#define YARP_FAKEFRAMEGRABBER_FAKEFRAMEGRABBER_H
27#include <condition_variable>
41#ifndef YARP_NO_DEPRECATED
64 bool close()
override;
94 int height()
const override;
95 int width()
const override;
99 std::vector<yarp::dev::vertex_t> vertices,
102 std::vector<yarp::dev::vertex_t> vertices,
153 static constexpr size_t default_w = 128;
154 static constexpr size_t default_h = 128;
155 static constexpr size_t default_freq = 30;
156 static constexpr double default_snr = 0.5;
163 unsigned long m_rnd{0};
165 bool m_have_bg{
false};
168 std::vector<yarp::dev::CameraConfig> configurations;
170 std::random_device rnddev;
171 std::default_random_engine randengine{rnddev()};
172 std::uniform_int_distribution<int> udist{-1, 1};
173 std::uniform_real_distribution<double> ucdist{0.0, 1.0};
175 std::mutex curr_buff_mutex;
178 bool img_ready[2] {
false,
false};
179 bool img_consumed[2] {
true,
true};
181 std::condition_variable img_ready_cv[2];
182 std::condition_variable img_consumed_cv[2];
184 mutable std::mutex rpc_methods_mutex;
196 void printTime(
unsigned char* pixbuf,
size_t pixbuf_w,
size_t pixbuf_h,
size_t x,
size_t y,
char* s,
size_t size);
This class is the parameters parser for class FakeFrameGrabber.
fakeFrameGrabber: A fake camera for testing.
int width() const override
Return the width of each frame.
yarp::dev::ReturnValue getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
yarp::dev::ReturnValue setResetDC1394() override
int getRgbWidth() override
Return the width of each frame.
yarp::dev::ReturnValue setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
int getRgbHeight() override
Return the height of each frame.
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
yarp::dev::ReturnValue setMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode mode) override
Set the requested mode for the feature.
yarp::dev::ReturnValue setPowerDC1394(bool onoff) override
yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
yarp::dev::ReturnValue getTransmissionDC1394(bool &bTxON) override
yarp::dev::ReturnValue getColorCodingDC1394(unsigned int &val) override
yarp::dev::ReturnValue setBytesPerPacketDC1394(unsigned int bpp) override
yarp::dev::ReturnValue getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
yarp::dev::ReturnValue setTransmissionDC1394(bool bTxON) override
yarp::dev::ReturnValue getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
yarp::dev::ReturnValue getISOSpeedDC1394(unsigned int &val) override
yarp::dev::ReturnValue setFPSDC1394(int fps) override
yarp::dev::ReturnValue getVideoModeDC1394(unsigned int &val) override
int height() const override
Return the height of each frame.
yarp::dev::ReturnValue setActive(yarp::dev::cameraFeature_id_t feature, bool onoff) override
Set the requested feature on or off.
yarp::dev::ReturnValue setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0) override
~FakeFrameGrabber() override=default
FakeFrameGrabber & operator=(FakeFrameGrabber &&)=delete
yarp::dev::ReturnValue getOperationModeDC1394(bool &b1394) override
FakeFrameGrabber & operator=(const FakeFrameGrabber &)=delete
yarp::dev::ReturnValue setDefaultsDC1394() override
yarp::dev::ReturnValue getActive(yarp::dev::cameraFeature_id_t feature, bool &isActive) override
Get the current status of the feature, on or off.
FakeFrameGrabber()=default
yarp::dev::ReturnValue getColorCodingMaskDC1394(unsigned int video_mode, unsigned int &val) override
yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double &value) override
Get the current value for the requested feature.
yarp::dev::ReturnValue setOperationModeDC1394(bool b1394b) override
bool open(yarp::os::Searchable &config) override
yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
yarp::dev::ReturnValue getVideoModeMaskDC1394(unsigned int &val) override
FakeFrameGrabber(const FakeFrameGrabber &)=delete
yarp::dev::ReturnValue getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an image from the frame grabber.
yarp::dev::ReturnValue setFeature(yarp::dev::cameraFeature_id_t feature, double value) override
Set the requested feature to a value (saturation, brightness ... )
yarp::dev::ReturnValue setISOSpeedDC1394(int speed) override
yarp::dev::ReturnValue getImageCrop(yarp::dev::cropType_id_t cropType, std::vector< yarp::dev::vertex_t > vertices, yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get a crop of the image from the frame grabber.
yarp::dev::ReturnValue setVideoModeDC1394(int video_mode) override
yarp::dev::ReturnValue getFPSMaskDC1394(unsigned int &val) override
yarp::dev::ReturnValue getMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode &mode) override
Get the current mode for the feature.
void run() override
Main body of the new thread.
void onStop() override
Call-back, called while halting the thread (before join).
yarp::dev::ReturnValue getBytesPerPacketDC1394(unsigned int &bpp) override
yarp::dev::ReturnValue getFPSDC1394(unsigned int &val) override
yarp::dev::ReturnValue setCaptureDC1394(bool bON) override
FakeFrameGrabber(FakeFrameGrabber &&)=delete
yarp::dev::ReturnValue getCameraDescription(yarp::dev::CameraDescriptor &camera) override
Get a basic description of the camera hw.
yarp::dev::ReturnValue getFormat7WindowDC1394(unsigned int &xdim, unsigned int &ydim, int &x0, int &y0) override
yarp::dev::ReturnValue setBroadcastDC1394(bool onoff) override
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue getFormat7MaxWindowDC1394(unsigned int &xdim, unsigned int &ydim, unsigned int &xstep, unsigned int &ystep, unsigned int &xoffstep, unsigned int &yoffstep) override
yarp::dev::ReturnValue setColorCodingDC1394(int coding) override
yarp::dev::ReturnValue setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue setOnePush(yarp::dev::cameraFeature_id_t feature) override
Set the requested feature to a value (saturation, brightness ... )
Interface implemented by all device drivers.
Control interface for frame grabber devices that conform to the 1394-based Digital Camera Specificati...
Control interface for frame grabber devices.
An interface for retrieving intrinsic parameter from a rgb camera.
An interface for reading from a network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
A mini-server for network communication.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
An abstraction for a time stamp and/or sequence number.
An abstraction for a thread of execution.