30 std::vector<std::string> params;
31 params.push_back(
"movie");
32 params.push_back(
"loop");
33 params.push_back(
"camera");
34 params.push_back(
"framerate");
35 params.push_back(
"width");
36 params.push_back(
"height");
37 params.push_back(
"flip_x");
38 params.push_back(
"flip_y");
39 params.push_back(
"transpose");
46 if (paramName ==
"movie")
51 if (paramName ==
"loop")
53 if (
m_loop==
true) paramValue =
"true";
54 else paramValue =
"false";
57 if (paramName ==
"camera")
59 paramValue = std::to_string(
m_camera);
62 if (paramName ==
"framerate")
67 if (paramName ==
"width")
69 paramValue = std::to_string(
m_width);
72 if (paramName ==
"height")
74 paramValue = std::to_string(
m_height);
77 if (paramName ==
"flip_x")
79 if (
m_flip_x==
true) paramValue =
"true";
80 else paramValue =
"false";
83 if (paramName ==
"flip_y")
85 if (
m_flip_y==
true) paramValue =
"true";
86 else paramValue =
"false";
89 if (paramName ==
"transpose")
92 else paramValue =
"false";
96 yError() <<
"parameter '" << paramName <<
"' was not found";
115 if (config.
check(
"help"))
124 if (config.
check(
"movie"))
127 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'movie' using value:" <<
m_movie;
131 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'movie' using DEFAULT value:" <<
m_movie;
133 prop_check.
unput(
"movie");
138 if (config.
check(
"loop"))
141 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'loop' using value:" <<
m_loop;
145 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'loop' using DEFAULT value:" <<
m_loop;
147 prop_check.
unput(
"loop");
152 if (config.
check(
"camera"))
155 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'camera' using value:" <<
m_camera;
159 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'camera' using DEFAULT value:" <<
m_camera;
161 prop_check.
unput(
"camera");
166 if (config.
check(
"framerate"))
169 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'framerate' using value:" <<
m_framerate;
173 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'framerate' using DEFAULT value:" <<
m_framerate;
175 prop_check.
unput(
"framerate");
180 if (config.
check(
"width"))
183 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'width' using value:" <<
m_width;
187 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'width' using DEFAULT value:" <<
m_width;
189 prop_check.
unput(
"width");
194 if (config.
check(
"height"))
197 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'height' using value:" <<
m_height;
201 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'height' using DEFAULT value:" <<
m_height;
203 prop_check.
unput(
"height");
208 if (config.
check(
"flip_x"))
211 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'flip_x' using value:" <<
m_flip_x;
215 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'flip_x' using DEFAULT value:" <<
m_flip_x;
217 prop_check.
unput(
"flip_x");
222 if (config.
check(
"flip_y"))
225 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'flip_y' using value:" <<
m_flip_y;
229 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'flip_y' using DEFAULT value:" <<
m_flip_y;
231 prop_check.
unput(
"flip_y");
236 if (config.
check(
"transpose"))
239 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'transpose' using value:" <<
m_transpose;
243 yCInfo(OpenCVGrabberParamsCOMPONENT) <<
"Parameter 'transpose' using DEFAULT value:" <<
m_transpose;
245 prop_check.
unput(
"transpose");
280 doc = doc + std::string(
"\n=============================================\n");
281 doc = doc + std::string(
"This is the help for device: OpenCVGrabber\n");
282 doc = doc + std::string(
"\n");
283 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
284 doc = doc + std::string(
"'movie': if present, read an .avi file instead of opening a camera\n");
285 doc = doc + std::string(
"'loop': if true, and movie parameter is set, enable the loop playback of the file\n");
286 doc = doc + std::string(
"'camera': Id of the camera hardware device\n");
287 doc = doc + std::string(
"'framerate': Framerate. Default value obtained by the hardware\n");
288 doc = doc + std::string(
"'width': Width of the frame. Default value obtained by the hardware\n");
289 doc = doc + std::string(
"'height': Height of the frame. Default value obtained by the hardware\n");
290 doc = doc + std::string(
"'flip_x': Flip along the x axis\n");
291 doc = doc + std::string(
"'flip_y': flip along the y axis\n");
292 doc = doc + std::string(
"'transpose': Rotate the image by 90 degrees\n");
293 doc = doc + std::string(
"\n");
294 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
295 doc = doc +
" yarpdev --device openCVGrabber --movie <optional_value> --loop false --camera 0 --framerate -1 --width 0 --height 0 --flip_x false --flip_y false --transpose false\n";
296 doc = doc + std::string(
"Using only mandatory params:\n");
297 doc = doc +
" yarpdev --device openCVGrabber\n";
298 doc = doc + std::string(
"=============================================\n\n");
return doc;
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
OpenCVGrabber_ParamsParser()
std::string getConfiguration() const override
Return the configuration of the device.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string m_provided_configuration
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
A class for storing options and configuration information.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)