YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameGrabberCropper.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_FRAMEGRABBERCROPPER_FRAMEGRABBERCROPPER_H
7#define YARP_FRAMEGRABBERCROPPER_FRAMEGRABBERCROPPER_H
8
15#include <yarp/dev/IWrapper.h>
17
18#include <limits>
20
21template <typename ImageType>
23 public yarp::dev::IFrameGrabberOf<ImageType>
24{
25protected:
28 std::vector<yarp::dev::vertex_t> vertices;
29
30public:
31 ~FrameGrabberCropperOf() override = default;
32
40
41 int height() const override
42 {
43 if (vertices.size() == 2) {
44 return vertices[1].y - vertices[0].y + 1;
45 }
46 return 0;
47 }
48
49 int width() const override
50 {
51 if (vertices.size() == 2) {
52 return vertices[1].x - vertices[0].x + 1;
53 }
54 return 0;
55 }
56};
57
70 public FrameGrabberCropperOf<yarp::sig::ImageOf<yarp::sig::PixelRgb>>,
71 public FrameGrabberCropperOf<yarp::sig::ImageOf<yarp::sig::PixelMono>>,
77{
78 yarp::dev::IFrameGrabberControls* iFrameGrabberControls{nullptr};
79 yarp::dev::IFrameGrabberControlsDC1394* iFrameGrabberControlsDC1394{nullptr};
80 yarp::dev::IRgbVisualParams* iRgbVisualParams{nullptr};
81 yarp::dev::IPreciselyTimed* iPreciselyTimed{nullptr};
82
83public:
89 ~FrameGrabberCropper() override;
90
91 // yarp::dev::DeviceDriver
92 bool close() override;
93 bool open(yarp::os::Searchable& config) override;
94
95 // yarp::dev::IWrapper
96 bool attach(yarp::dev::PolyDriver* poly) override;
97 bool detach() override;
98
99 // yarp::dev::IMultipleWrapper
100 bool attachAll(const yarp::dev::PolyDriverList& device2attach) override;
101 bool detachAll() override;
102
103
104 // yarp::dev::IFrameGrabberControls
109 yarp::dev::ReturnValue setFeature(yarp::dev::cameraFeature_id_t feature, double value1, double value2) override;
110 yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double& value1, double& value2) override;
120
121 // yarp::dev::IFrameGrabberControlsDC1394
122 yarp::dev::ReturnValue getVideoModeMaskDC1394(unsigned int& val) override;
123 yarp::dev::ReturnValue getVideoModeDC1394(unsigned int& val) override;
124 yarp::dev::ReturnValue setVideoModeDC1394(int video_mode) override;
125 yarp::dev::ReturnValue getFPSMaskDC1394(unsigned int& val) override;
126 yarp::dev::ReturnValue getFPSDC1394(unsigned int& val) override;
128 yarp::dev::ReturnValue getISOSpeedDC1394(unsigned int& val) override;
129 yarp::dev::ReturnValue setISOSpeedDC1394(int speed) override;
130 yarp::dev::ReturnValue getColorCodingMaskDC1394(unsigned int video_mode, unsigned int& val) override;
131 yarp::dev::ReturnValue getColorCodingDC1394(unsigned int& val) override;
132 yarp::dev::ReturnValue setColorCodingDC1394(int coding) override;
134 unsigned int& ydim,
135 unsigned int& xstep,
136 unsigned int& ystep,
137 unsigned int& xoffstep,
138 unsigned int& yoffstep) override;
139 yarp::dev::ReturnValue getFormat7WindowDC1394(unsigned int& xdim, unsigned int& ydim, int& x0, int& y0) override;
140 yarp::dev::ReturnValue setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0) override;
142 yarp::dev::ReturnValue getOperationModeDC1394(bool& b1394b) override;
144 yarp::dev::ReturnValue getTransmissionDC1394(bool& bTxON) override;
145 yarp::dev::ReturnValue setBroadcastDC1394(bool onoff) override;
148 yarp::dev::ReturnValue setPowerDC1394(bool onoff) override;
149 yarp::dev::ReturnValue setCaptureDC1394(bool bON) override;
150 yarp::dev::ReturnValue getBytesPerPacketDC1394(unsigned int& bpp) override;
152
153 // yarp::dev::IRgbVisualParams
154 int getRgbHeight() override;
155 int getRgbWidth() override;
158 yarp::dev::ReturnValue getRgbFOV(double& horizontalFov, double& verticalFov) override;
159 yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov) override;
161 yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector<yarp::dev::CameraConfig>& cfgs) override;
162 yarp::dev::ReturnValue getRgbMirroring(bool& mirror) override;
163 yarp::dev::ReturnValue setRgbMirroring(bool mirror) override;
164
165 // yarp::dev::IPreciselyTimed
167 {
168 if (!iPreciselyTimed) {
169 return yarp::os::Stamp();
170 }
171 return iPreciselyTimed->getLastInputStamp();
172 }
173};
174
175#endif // YARP_FRAMEGRABBERCROPPER_FRAMEGRABBERCROPPER_H
CameraDescriptor camera
FeatureMode mode
static constexpr yarp::dev::cropType_id_t cropType
~FrameGrabberCropperOf() override=default
std::vector< yarp::dev::vertex_t > vertices
yarp::dev::ReturnValue getImage(ImageType &image) override
Get an image from the frame grabber.
yarp::dev::IFrameGrabberOf< ImageType > * iFrameGrabberOf
int width() const override
Return the width of each frame.
int height() const override
Return the height of each frame.
This class is the parameters parser for class FrameGrabberCropper.
FrameGrabberCropper: An image frame grabber device which can also crop the frame.
yarp::dev::ReturnValue setActive(yarp::dev::cameraFeature_id_t feature, bool onoff) override
Set the requested feature on or off.
yarp::dev::ReturnValue setColorCodingDC1394(int coding) override
yarp::dev::ReturnValue getBytesPerPacketDC1394(unsigned int &bpp) override
bool close() override
Close the DeviceDriver.
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 getTransmissionDC1394(bool &bTxON) override
yarp::dev::ReturnValue setPowerDC1394(bool onoff) override
yarp::dev::ReturnValue getCameraDescription(yarp::dev::CameraDescriptor &camera) override
Get a basic description of the camera hw.
FrameGrabberCropper(const FrameGrabberCropper &)=delete
yarp::dev::ReturnValue getColorCodingDC1394(unsigned int &val) override
yarp::dev::ReturnValue setISOSpeedDC1394(int speed) override
yarp::dev::ReturnValue getFormat7WindowDC1394(unsigned int &xdim, unsigned int &ydim, int &x0, int &y0) override
yarp::dev::ReturnValue setDefaultsDC1394() override
yarp::dev::ReturnValue setFPSDC1394(int fps) override
yarp::dev::ReturnValue getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
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 setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0) override
yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
yarp::dev::ReturnValue setBytesPerPacketDC1394(unsigned int bpp) override
yarp::dev::ReturnValue getOperationModeDC1394(bool &b1394b) override
yarp::dev::ReturnValue setBroadcastDC1394(bool onoff) override
yarp::dev::ReturnValue getISOSpeedDC1394(unsigned int &val) override
yarp::dev::ReturnValue getVideoModeDC1394(unsigned int &val) override
bool attachAll(const yarp::dev::PolyDriverList &device2attach) override
Attach to a list of objects.
yarp::dev::ReturnValue getVideoModeMaskDC1394(unsigned int &val) override
int getRgbWidth() override
Return the width of each frame.
bool detach() override
Detach the object (you must have first called attach).
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 getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
yarp::dev::ReturnValue setOnePush(yarp::dev::cameraFeature_id_t feature) override
Set the requested feature to a value (saturation, brightness ... )
FrameGrabberCropper(FrameGrabberCropper &&)=delete
yarp::dev::ReturnValue getMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode &mode) override
Get the current mode for the feature.
FrameGrabberCropper & operator=(FrameGrabberCropper &&)=delete
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector< yarp::dev::CameraConfig > &cfgs) override
Get the possible configurations of the camera.
yarp::dev::ReturnValue getFPSDC1394(unsigned int &val) override
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool detachAll() override
Detach the object (you must have first called attach).
FrameGrabberCropper & operator=(const FrameGrabberCropper &)=delete
yarp::dev::ReturnValue setCaptureDC1394(bool bON) override
yarp::dev::ReturnValue getColorCodingMaskDC1394(unsigned int video_mode, unsigned int &val) override
yarp::dev::ReturnValue getFPSMaskDC1394(unsigned int &val) override
yarp::dev::ReturnValue setVideoModeDC1394(int video_mode) override
yarp::dev::ReturnValue setOperationModeDC1394(bool b1394b) override
yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
yarp::dev::ReturnValue getActive(yarp::dev::cameraFeature_id_t feature, bool &isActive) override
Get the current status of the feature, on or off.
yarp::dev::ReturnValue setResetDC1394() override
yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double &value) override
Get the current value for the requested feature.
int getRgbHeight() override
Return the height of each frame.
yarp::dev::ReturnValue setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
yarp::dev::ReturnValue getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
FrameGrabberCropper()=default
yarp::dev::ReturnValue setTransmissionDC1394(bool bTxON) override
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
yarp::dev::ReturnValue setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
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.
Read a YARP-format image (of a specific type) from a device.
Interface for an object that can wrap/attach to to another.
virtual yarp::os::Stamp getLastInputStamp()=0
Return the time stamp relative to the last acquisition.
An interface for retrieving intrinsic parameter from a rgb camera.
Interface for an object that can wrap/or "attach" to another.
Definition IWrapper.h:25
A container for a device driver.
Definition PolyDriver.h:23
@ return_value_error_not_ready
Method failed due to invalid internal status/invalid request.
A class for storing options and configuration information.
Definition Property.h:33
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21