YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
pylonCameraDriver.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006-2022 Istituto Italiano di Tecnologia (IIT)
3 * All rights reserved.
4 *
5 * This software may be modified and distributed under the terms of the
6 * BSD-3-Clause license. See the accompanying LICENSE file for details.
7 */
8
9#include <opencv2/core/core_c.h>
10#include <yarp/cv/Cv.h>
12#include <yarp/os/Value.h>
13#include <yarp/sig/ImageUtils.h>
14
15#include <algorithm>
16#include <cmath>
17#include <cstdint>
18#include <iomanip>
19#include <opencv2/opencv.hpp>
20#include <opencv2/videoio.hpp>
21#if defined USE_CUDA
22#include <opencv2/cudawarping.hpp>
23#endif // USE_CUDA
24
25#include "pylonCameraDriver.h"
26
27using namespace yarp::dev;
28using namespace yarp::sig;
29using namespace yarp::os;
30using namespace Pylon;
31using namespace cv;
32
33using namespace std;
34
35// VERY IMPORTANT ABOUT WHITE BALANCE: the YARP interfaces cannot allow to set a feature with
36// 3 values, 2 is maximum and until now we always used blue and red in this order. Then we ignore
37// green
38
40 // YARP_FEATURE_GAMMA, // it seems not writable
42 // YARP_FEATURE_TRIGGER, // not sure how to use it
44
46
47// Values taken from the balser documentation for da4200-30mci
48static const std::map<cameraFeature_id_t, std::pair<double, double>> featureMinMax{{YARP_FEATURE_BRIGHTNESS, {-1.0, 1.0}},
49 {YARP_FEATURE_EXPOSURE, {68.0, 2300000.0}},
50 {YARP_FEATURE_SHARPNESS, {0.0, 1.0}},
51 {YARP_FEATURE_WHITE_BALANCE, {1.0, 8.0}}, // not sure about it, the doc is not clear, found empirically
52 //{YARP_FEATURE_GAMMA, {0.0, 4.0}},
53 {YARP_FEATURE_GAIN, {0.0, 33.06}}};
54
55static const std::map<double, int> rotationToCVRot{{90.0, ROTATE_90_CLOCKWISE}, {-90.0, ROTATE_90_COUNTERCLOCKWISE}, {180.0, ROTATE_180}};
56
57// We usually set the features through a range between 0 an 1, we have to translate it in meaninful value for the camera
59{
60 return value * (featureMinMax.at(feature).second - featureMinMax.at(feature).first) + featureMinMax.at(feature).first;
61}
62
63// We want the features in the range 0 1
65{
66 return (value - featureMinMax.at(feature).first) / (featureMinMax.at(feature).second - featureMinMax.at(feature).first);
67}
68
69bool pylonCameraDriver::setFramerate(const float _fps)
70{
71 auto res = setOption("AcquisitionFrameRate", _fps);
72 if (res)
73 {
74 m_fps = _fps;
75 }
76 return res;
77}
78
79bool parseUint32Param(std::string param_name, std::uint32_t& param, yarp::os::Searchable& config)
80{
81 if (config.check(param_name) && config.find(param_name).isInt32())
82 {
83 param = config.find(param_name).asInt32();
84 return true;
85 }
86 else
87 {
88 yCWarning(PYLON_CAMERA) << param_name << "parameter not specifie, using" << param;
89 return false;
90 }
91}
92bool parseFloat64Param(std::string param_name, double& param, yarp::os::Searchable& config)
93{
94 if (config.check(param_name) && config.find(param_name).isFloat64())
95 {
96 param = config.find(param_name).asFloat64();
97 return true;
98 }
99 else
100 {
101 yCWarning(PYLON_CAMERA) << param_name << "parameter not specified, using" << param;
102 return false;
103 }
104}
105bool parseStringParam(std::string param_name, std::string& param, yarp::os::Searchable& config)
106{
107 if (config.check(param_name) && config.find(param_name).isString())
108 {
109 param = config.find(param_name).asString();
110 return true;
111 }
112 else
113 {
114 yCWarning(PYLON_CAMERA) << param_name << "parameter not specified, using" << param;
115 return false;
116 }
117}
118
119bool parseBooleanParam(std::string param_name, bool& param, yarp::os::Searchable& config)
120{
121 if (config.check(param_name) && config.find(param_name).isBool())
122 {
123 param = config.find(param_name).asBool();
124 return true;
125 }
126 else
127 {
128 yCWarning(PYLON_CAMERA) << param_name << "parameter not specified, using" << param;
129 return false;
130 }
131}
132
133bool pylonCameraDriver::startCamera()
134{
135 if (m_camera_ptr)
136 {
137 if (!m_camera_ptr->IsGrabbing())
138 {
139 m_camera_ptr->StartGrabbing(GrabStrategy_LatestImageOnly);
140 }
141 }
142 return true;
143}
144
145bool pylonCameraDriver::stopCamera()
146{
147 if (m_camera_ptr)
148 {
149 if (m_camera_ptr->IsGrabbing())
150 {
151 m_camera_ptr->StopGrabbing();
152 }
153 }
154 return true;
155}
156
158{
159 bool ok{true};
160 yCTrace(PYLON_CAMERA) << "input params are " << config.toString();
161 if (!config.check("serial_number"))
162 {
163 yCError(PYLON_CAMERA) << "serial_number parameter not specified";
164 return false;
165 }
166 // TODO understand how to treat it, if string or int
167 m_serial_number = config.find("serial_number").toString().c_str();
168
169 double period{0.03};
170 parseUint32Param("width", m_width, config);
171 parseUint32Param("height", m_height, config);
172 parseFloat64Param("period", period, config);
173 parseFloat64Param("rotation", m_rotation, config);
174 parseBooleanParam("rotation_with_crop", m_rotationWithCrop, config);
175
176 if (m_rotationWithCrop)
177 {
178 if (m_rotation == -90.0 || m_rotation == 90.0)
179 {
180 std::swap(m_width, m_height);
181 }
182 yCDebug(PYLON_CAMERA) << "Rotation with crop";
183 }
184
185 if (period != 0.0)
186 {
187 m_fps = 1.0 / period; // the fps has to be aligned with the nws period
188 }
189
190 // Initialize pylon resources
192 // Get factory singleton
193 CTlFactory& factory = CTlFactory::GetInstance();
194 yCDebug(PYLON_CAMERA) << "SERIAL NUMBER!" << m_serial_number << config.find("serial_number").asString();
195 // Open the device using the S/N
196 try
197 {
198 m_camera_ptr = std::make_unique<Pylon::CInstantCamera>(factory.CreateDevice(CDeviceInfo().SetSerialNumber(m_serial_number)));
199 if (m_camera_ptr)
200 {
201 m_camera_ptr->Open();
202 if (!m_camera_ptr->IsOpen())
203 {
204 yCError(PYLON_CAMERA) << "Camera" << m_serial_number << "cannot be opened";
205 return false;
206 }
207 }
208 else
209 {
210 yCError(PYLON_CAMERA) << "Camera" << m_serial_number << "cannot be opened";
211 return false;
212 }
213 }
214 catch (const GenericException& e)
215 {
216 // Error handling.
217 yCError(PYLON_CAMERA) << "Camera" << m_serial_number << "cannot be opened, error:" << e.GetDescription();
218 return false;
219 }
220 // TODO get it from conf
221
222 auto& nodemap = m_camera_ptr->GetNodeMap();
223 // TODO maybe put in a try catch
224 ok = ok && setOption("AcquisitionFrameRateEnable", true);
225 ok = ok && setOption("BslScalingEnable", true);
226 ok = ok && setRgbResolution(m_width, m_height);
227
228 // TODO disabling it for testing the network, probably it is better to keep it as Auto
229 ok = ok && setOption("ExposureAuto", "Off", true);
230
231 ok = ok && setFramerate(m_fps);
232
233 yCDebug(PYLON_CAMERA) << "Starting with this fps" << CFloatParameter(nodemap, "AcquisitionFrameRate").GetValue();
234
235#if defined USE_CUDA
236 yCDebug(PYLON_CAMERA) << "Using CUDA!";
237#else
238 yCDebug(PYLON_CAMERA) << "Not using CUDA!";
239#endif
240
241 return ok && startCamera();
242}
243
245{
246 if (m_camera_ptr->IsPylonDeviceAttached())
247 {
248 m_camera_ptr->DetachDevice();
249 }
250 // Releases all pylon resources.
252 return true;
253}
254
256{
257 return m_height;
258}
259
261{
262 return m_width;
263}
264
266{
267 yCWarning(PYLON_CAMERA) << "getRgbSupportedConfigurations not implemented yet";
268 return false;
269}
270
271bool pylonCameraDriver::getRgbResolution(int& width, int& height)
272{
273 width = m_width;
274 height = m_height;
275 return true;
276}
277
278bool pylonCameraDriver::setRgbResolution(int width, int height)
279{
280 bool res = false;
281 if (width > 0 && height > 0)
282 {
283 res = setOption("Width", width);
284 res = res && setOption("Height", height);
285 if (res)
286 {
287 m_width = width;
288 m_height = height;
289 }
290 }
291 return res;
292}
293
294bool pylonCameraDriver::setRgbFOV(double horizontalFov, double verticalFov)
295{
296 yCWarning(PYLON_CAMERA) << "setRgbFOV not supported";
297 return false;
298}
299
300bool pylonCameraDriver::getRgbFOV(double& horizontalFov, double& verticalFov)
301{
302 yCWarning(PYLON_CAMERA) << "getRgbFOV not supported";
303 return false;
304}
305
307{
308 yCWarning(PYLON_CAMERA) << "Mirroring not supported";
309 return false;
310}
311
313{
314 yCWarning(PYLON_CAMERA) << "Mirroring not supported";
315 return false;
316}
317
319{
320 yCWarning(PYLON_CAMERA) << "getRgbIntrinsicParam not implemented yet";
321 return false;
322}
323
325{
326 yCWarning(PYLON_CAMERA) << "getCameraDescription not implemented yet";
327 return false;
328}
329
330bool pylonCameraDriver::hasFeature(int feature, bool* hasFeature)
331{
333 f = static_cast<cameraFeature_id_t>(feature);
335 {
336 return false;
337 }
338
339 *hasFeature = std::find(supported_features.begin(), supported_features.end(), f) != supported_features.end();
340
341 return true;
342}
343
345{
346 bool b = false;
347 if (!hasFeature(feature, &b) || !b)
348 {
349 yCError(PYLON_CAMERA) << "Feature not supported!";
350 return false;
351 }
352 b = false;
353 auto f = static_cast<cameraFeature_id_t>(feature);
354 switch (f)
355 {
357 b = setOption("BslBrightness", fromZeroOneToRange(f, value));
358 break;
360 // According to https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/extended-controls.html
361 // 1 unit = 100us, basler instead accept us. Setting directly in us.
362 b = setOption("ExposureTime", fromZeroOneToRange(f, value));
363 break;
365 b = setOption("BslSharpnessEnhancement", fromZeroOneToRange(f, value));
366 break;
368 b = false;
369 yCError(PYLON_CAMERA) << "White balance require 2 values";
370 break;
372 b = setOption("Gain", fromZeroOneToRange(f, value));
373 break;
375 b = setFramerate(value);
376 break;
377 default:
378 yCError(PYLON_CAMERA) << "Feature not supported!";
379 return false;
380 }
381
382 return b;
383}
384
386{
387 bool b = false;
388 if (!hasFeature(feature, &b) || !b)
389 {
390 yCError(PYLON_CAMERA) << "Feature not supported!";
391 return false;
392 }
393 b = false;
394 auto f = static_cast<cameraFeature_id_t>(feature);
395 switch (f)
396 {
398 b = getOption("BslBrightness", value);
399 break;
401 b = getOption("ExposureTime", value);
402 break;
404 b = getOption("BslSharpnessEnhancement", value);
405 break;
407 b = false;
408 yCError(PYLON_CAMERA) << "White balance is a 2-values feature";
409 break;
411 b = getOption("Gain", value);
412 break;
414 b = true;
415 *value = m_fps;
416 break;
417 default:
418 yCError(PYLON_CAMERA) << "Feature not supported!";
419 return false;
420 }
421
422 *value = fromRangeToZeroOne(f, *value);
423 yCDebug(PYLON_CAMERA) << "In 0-1" << *value;
424 return b;
425}
426
428{
429 auto f = static_cast<cameraFeature_id_t>(feature);
431 {
432 yCError(PYLON_CAMERA) << YARP_FEATURE_WHITE_BALANCE << "is not a 2-values feature supported";
433 return false;
434 }
435
436 auto res = setOption("BalanceRatioSelector", "Blue", true);
437 res = res && setOption("BalanceRatio", fromZeroOneToRange(f, value1));
438 res = res && setOption("BalanceRatioSelector", "Red", true);
439 res = res && setOption("BalanceRatio", fromZeroOneToRange(f, value2));
440 return res;
441}
442
444{
445 auto f = static_cast<cameraFeature_id_t>(feature);
447 {
448 yCError(PYLON_CAMERA) << "This is not a 2-values feature supported";
449 return false;
450 }
451
452 auto res = setOption("BalanceRatioSelector", "Blue", true);
453 res = res && getOption("BalanceRatio", value1);
454 res = res && setOption("BalanceRatioSelector", "Red", true);
455 res = res && getOption("BalanceRatio", value2);
458 yCDebug(PYLON_CAMERA) << "In 0-1" << *value1;
459 yCDebug(PYLON_CAMERA) << "In 0-1" << *value2;
460 return res;
461}
462
464{
465 return hasAuto(feature, HasOnOff);
466}
467
469{
470 bool b = false;
471 if (!hasFeature(feature, &b) || !b)
472 {
473 yCError(PYLON_CAMERA) << "Feature" << feature << "not supported!";
474 return false;
475 }
476
477 if (!hasOnOff(feature, &b) || !b)
478 {
479 yCError(PYLON_CAMERA) << "Feature" << feature << "does not have OnOff.. call hasOnOff() to know if a specific feature support OnOff mode";
480 return false;
481 }
482
483 std::string val_to_set = onoff ? "Continuous" : "Off";
484
485 switch (feature)
486 {
488 b = setOption("ExposureAuto", val_to_set.c_str(), true);
489 break;
491 b = setOption("BalanceWhiteAuto", val_to_set.c_str(), true);
492 break;
494 b = setOption("GainAuto", val_to_set.c_str(), true);
495 break;
496 default:
497 yCError(PYLON_CAMERA) << "Feature" << feature << "not supported!";
498 return false;
499 }
500
501 return b;
502}
503
504bool pylonCameraDriver::getActive(int feature, bool* isActive)
505{
506 bool b = false;
507 if (!hasFeature(feature, &b) || !b)
508 {
509 yCError(PYLON_CAMERA) << "Feature" << feature << "not supported!";
510 return false;
511 }
512
513 if (!hasOnOff(feature, &b) || !b)
514 {
515 yCError(PYLON_CAMERA) << "Feature" << feature << "does not have OnOff.. call hasOnOff() to know if a specific feature support OnOff mode";
516 return false;
517 }
518
519 std::string val_to_get{""};
520
521 switch (feature)
522 {
524 b = getOption("ExposureAuto", val_to_get, true);
525 break;
527 b = getOption("BalanceWhiteAuto", val_to_get, true);
528 break;
530 b = getOption("GainAuto", val_to_get, true);
531 break;
532 default:
533 yCError(PYLON_CAMERA) << "Feature" << feature << "not supported!";
534 return false;
535 }
536 if (b)
537 {
538 if (val_to_get == "Continuous")
539 {
540 *isActive = true;
541 }
542 else if (val_to_get == "Off")
543 {
544 *isActive = false;
545 }
546 }
547 return b;
548}
549
550bool pylonCameraDriver::hasAuto(int feature, bool* hasAuto)
551{
553 f = static_cast<cameraFeature_id_t>(feature);
555 {
556 return false;
557 }
558
559 *hasAuto = std::find(features_with_auto.begin(), features_with_auto.end(), f) != features_with_auto.end();
560
561 return true;
562}
563
564bool pylonCameraDriver::hasManual(int feature, bool* hasManual)
565{
567}
568
569bool pylonCameraDriver::hasOnePush(int feature, bool* hasOnePush)
570{
571 return hasAuto(feature, hasOnePush);
572}
573
575{
576 bool b{false};
577 if (!hasAuto(feature, &b) || !b)
578 {
579 yCError(PYLON_CAMERA) << "Feature" << feature << "not supported!";
580 return false;
581 }
582
583 switch (mode)
584 {
585 case MODE_AUTO:
586 return setActive(feature, true);
587 case MODE_MANUAL:
588 return setActive(feature, false);
589 case MODE_UNKNOWN:
590 return false;
591 default:
592 return false;
593 }
594 return b;
595}
596
598{
599 bool b{false};
600 if (!hasAuto(feature, &b) || !b)
601 {
602 yCError(PYLON_CAMERA) << "Feature" << feature << "not supported!";
603 return false;
604 }
605 bool get_active{false};
606 b = b && getActive(feature, &get_active);
607
608 if (b)
609 {
610 if (get_active)
611 {
612 *mode = MODE_AUTO;
613 }
614 else
615 {
616 *mode = MODE_MANUAL;
617 }
618 }
619 return b;
620}
621
623{
624 bool b = false;
625 if (!hasOnePush(feature, &b) || !b)
626 {
627 yCError(PYLON_CAMERA) << "Feature" << feature << "doesn't have OnePush";
628 return false;
629 }
630
631 b = b && setMode(feature, MODE_AUTO);
632 b = b && setMode(feature, MODE_MANUAL);
633
634 return b;
635}
636
638{
639 std::lock_guard<std::mutex> guard(m_mutex);
640 if (m_camera_ptr->IsGrabbing())
641 {
645 // In case of rotation we need to use BGR coding because we use opencv.
646 pylon_format_converter.OutputPixelFormat = m_rotation != 0.0 ? PixelType_BGR8packed : PixelType_RGB8packed;
647 // Wait for an image and then retrieve it. A timeout of 5000 ms is used.
648 // TODO change the hardcoded 5000 to the exposure time.
649 try
650 {
651 m_camera_ptr->RetrieveResult(5000, grab_result_ptr, TimeoutHandling_ThrowException);
652 }
653 catch (const Pylon::GenericException& e)
654 {
655 // Error handling.
656 yCError(PYLON_CAMERA) << "Camera" << m_serial_number << "cannot get images error:" << e.GetDescription();
657 return false;
658 }
659 // Image grabbed successfully?
660 if (grab_result_ptr && grab_result_ptr->GrabSucceeded())
661 {
662 m_width = grab_result_ptr->GetWidth();
663 m_height = grab_result_ptr->GetHeight();
664 size_t mem_to_wrt = m_width * m_height * image.getPixelSize();
665
666 if (m_rotation == -90.0 || m_rotation == 90.0)
667 {
668 std::swap(m_width, m_height);
669 }
670
671 // TODO Check pixel code
672 image.resize(m_width, m_height);
674 if (!pylon_image.IsValid())
675 {
676 yCError(PYLON_CAMERA) << "Frame invalid!";
677 return false;
678 }
679
680 // For some reason the first frame cannot be converted To be investigated
681 static bool first_acquisition{true};
683 {
684 yCDebug(PYLON_CAMERA) << "Skipping";
685 first_acquisition = false;
686 return false;
687 }
688
689 if (m_rotation != 0.0)
690 {
691 Mat rotated(grab_result_ptr->GetHeight(), grab_result_ptr->GetWidth(), CV_8UC3, (uint8_t*)pylon_image.GetBuffer());
692 // warpAffine(Mat(grab_result_ptr->GetHeight(), grab_result_ptr->GetWidth(), CV_8UC3, (uint8_t*)pylon_image.GetBuffer()),
693 // rotated, getRotationMatrix2D( Point( grab_result_ptr->GetWidth()/2, grab_result_ptr->GetHeight()/2 ),
694 // m_rotation, 1.0 ), rotated.size());
695#if defined USE_CUDA
696 cv::cuda::GpuMat gpu_im;
697 gpu_im.upload(rotated); // RAM => GPU
698
699 // Rotate from 90
700 cv::Size size = rotated.size();
701 cv::cuda::GpuMat gpu_im_rot;
702 // TODO che if the resulting image is W x H or viceversa
703 cv::cuda::rotate(gpu_im, gpu_im_rot, cv::Size(size.height, size.width), m_rotation, size.height - 1, 0, cv::INTER_LINEAR);
704
705 gpu_im_rot.download(rotated); // GPU => RAM
706
707#else
708 cv::rotate(rotated, rotated, rotationToCVRot.at(m_rotation));
709#endif // USE_CUDA
710 image.copy(yarp::cv::fromCvMat<yarp::sig::PixelRgb>(rotated));
711 }
712 else
713 {
714 memcpy((void*)image.getRawImage(), pylon_image.GetBuffer(), mem_to_wrt);
715 }
716 }
717 else
718 {
719 yCError(PYLON_CAMERA) << "Acquisition failed";
720 return false;
721 }
722 return true;
723 }
724 else
725 {
726 yCError(PYLON_CAMERA) << "Errors in retrieving images";
727 return false;
728 }
729}
730
732{
733 return m_height;
734}
735
737{
738 return m_width;
739}
@ YARP_FEATURE_NUMBER_OF
@ YARP_FEATURE_SHARPNESS
@ YARP_FEATURE_FRAME_RATE
@ YARP_FEATURE_BRIGHTNESS
@ YARP_FEATURE_WHITE_BALANCE
@ YARP_FEATURE_EXPOSURE
@ YARP_FEATURE_GAIN
bool parseUint32Param(std::string param_name, std::uint32_t &param, yarp::os::Searchable &config)
static const std::vector< cameraFeature_id_t > supported_features
static const std::vector< cameraFeature_id_t > features_with_auto
double fromZeroOneToRange(cameraFeature_id_t feature, double value)
double fromRangeToZeroOne(cameraFeature_id_t feature, double value)
static const std::map< double, double > rotationToCVRot
int getRgbWidth() override
Return the width of each frame.
bool getActive(int feature, bool *isActive) override
Get the current status of the feature, on or off.
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
bool setActive(int feature, bool onoff) override
Set the requested feature on or off.
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
bool hasAuto(int feature, bool *hasAuto) override
Check if the requested feature has the 'auto' mode.
bool setOnePush(int feature) override
Set the requested feature to a value (saturation, brightness ... )
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
bool hasFeature(int feature, bool *hasFeature) override
Check if camera has the requested feature (saturation, brightness ... )
bool getRgbIntrinsicParam(Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
bool hasOnePush(int feature, bool *hasOnePush) override
Check if the requested feature has the 'onePush' mode.
bool close() override
Close the DeviceDriver.
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
int height() const override
Return the height of each frame.
bool hasOnOff(int feature, bool *HasOnOff) override
Check if the camera has the ability to turn on/off the requested feature.
bool getCameraDescription(CameraDescriptor *camera) override
Get a basic description of the camera hw.
bool getMode(int feature, FeatureMode *mode) override
Get the current mode for the feature.
bool hasManual(int feature, bool *hasManual) override
Check if the requested feature has the 'manual' mode.
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
int width() const override
Return the width of each frame.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool getFeature(int feature, double *value) override
Get the current value for the requested feature.
bool setFeature(int feature, double value) override
Set the requested feature to a value (saturation, brightness ... )
int getRgbHeight() override
Return the height of each frame.
bool setMode(int feature, FeatureMode mode) override
Set the requested mode for the feature.
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an image from the frame grabber.
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
A mini-server for performing network communication in the background.
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
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.
Typed image class.
Definition Image.h:605
size_t getPixelSize() const override
Gets pixel size in memory in bytes.
Definition Image.h:615
unsigned char * getRawImage() const
Access to the internal image buffer.
Definition Image.cpp:479
bool copy(const Image &alt)
Copy operator.
Definition Image.cpp:624
void resize(size_t imgWidth, size_t imgHeight)
Reallocate an image to be of a desired size, throwing away its current contents.
Definition Image.cpp:402
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
STL namespace.
For streams capable of holding different kinds of content, check what they actually have.
Definition jointData.cpp:13
An interface to the operating system, including Port based communication.
bool parseUint32Param(std::string param_name, std::uint32_t &param, yarp::os::Searchable &config)
bool parseFloat64Param(std::string param_name, double &param, yarp::os::Searchable &config)
static const std::vector< cameraFeature_id_t > supported_features
static const std::vector< cameraFeature_id_t > features_with_auto
double fromZeroOneToRange(cameraFeature_id_t feature, double value)
static const std::map< double, int > rotationToCVRot
bool parseBooleanParam(std::string param_name, bool &param, yarp::os::Searchable &config)
double fromRangeToZeroOne(cameraFeature_id_t feature, double value)
static const std::map< cameraFeature_id_t, std::pair< double, double > > featureMinMax
bool parseStringParam(std::string param_name, std::string &param, yarp::os::Searchable &config)