YARP
Yet Another Robot Platform
FakeFrameGrabber.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include "FakeFrameGrabber.h"
11 
12 #include <yarp/os/LogComponent.h>
13 #include <yarp/os/LogStream.h>
14 #include <yarp/sig/ImageDraw.h>
15 
16 #include <cstdio>
17 #include <random>
18 
19 using namespace yarp::os;
20 using namespace yarp::dev;
21 using namespace yarp::sig;
22 using namespace yarp::sig::draw;
23 
24 namespace {
25 YARP_LOG_COMPONENT(FAKEFRAMEGRABBER, "yarp.device.fakeFrameGrabber")
26 constexpr yarp::conf::vocab32_t VOCAB_BALL = yarp::os::createVocab('b','a','l','l');
27 constexpr yarp::conf::vocab32_t VOCAB_GRID = yarp::os::createVocab('g','r','i','d');
28 constexpr yarp::conf::vocab32_t VOCAB_RAND = yarp::os::createVocab('r','a','n','d');
29 constexpr yarp::conf::vocab32_t VOCAB_NONE = yarp::os::createVocab('n','o','n','e');
30 constexpr yarp::conf::vocab32_t VOCAB_GRID_MULTISIZE = yarp::os::createVocab('s','i','z','e');
31 constexpr yarp::conf::vocab32_t VOCAB_TIMETEXT = yarp::os::createVocab('t','i','m','e');
32 }
33 
35  ct(0),
36  bx(0),
37  by(0),
38  w(128),
39  h(128),
40  rnd(0),
41  freq(30),
42  period(1/freq),
43  first(0),
44  horizontalFov(0.0),
45  verticalFov(0.0),
46  prev(0),
47  mode(0),
48  use_bayer(false),
49  use_mono(false),
50  mirror(false)
51 {
52  //the following data are used by [time] test
53  std::snprintf(num[0].data, 16, "**** ** ** ****");
54  std::snprintf(num[1].data, 16, " * * * * * ");
55  std::snprintf(num[2].data, 16, "*** ***** ***");
56  std::snprintf(num[3].data, 16, "*** **** ****");
57  std::snprintf(num[4].data, 16, "* ** **** * *");
58  std::snprintf(num[5].data, 16, "**** *** ****");
59  std::snprintf(num[6].data, 16, "**** **** ****");
60  std::snprintf(num[7].data, 16, "*** * * * *");
61  std::snprintf(num[8].data, 16, "**** ***** ****");
62  std::snprintf(num[9].data, 16, "**** **** ****");
63  std::snprintf(num[10].data, 16, " ");
64  std::snprintf(num[11].data, 16, " ** **");
65  start_time = yarp::os::Time::now();
66 }
67 
68 
70  return true;
71 }
72 
74  yarp::os::Value *val;
75  Value* retM;
76  retM=Value::makeList("1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0");
77  w = config.check("width",yarp::os::Value(320),
78  "desired width of test image").asInt32();
79  h = config.check("height",yarp::os::Value(240),
80  "desired height of test image").asInt32();
81  horizontalFov=config.check("horizontalFov",Value(1.0),
82  "desired horizontal fov of test image").asFloat64();
83  verticalFov=config.check("verticalFov",Value(2.0),
84  "desired vertical fov of test image").asFloat64();
85  mirror=config.check("mirror",Value(false),
86  "mirroring disabled by default").asBool();
87  intrinsic.put("physFocalLength",config.check("physFocalLength",Value(3.0),"Physical focal length of the fakeFrameGrabber").asFloat64());
88  intrinsic.put("focalLengthX",config.check("focalLengthX",Value(4.0),"Horizontal component of the focal length of the fakeFrameGrabber").asFloat64());
89  intrinsic.put("focalLengthY",config.check("focalLengthY",Value(5.0),"Vertical component of the focal length of the fakeFrameGrabber").asFloat64());
90  intrinsic.put("principalPointX",config.check("principalPointX",Value(6.0),"X coordinate of the principal point of the fakeFrameGrabber").asFloat64());
91  intrinsic.put("principalPointY",config.check("principalPointY",Value(7.0),"Y coordinate of the principal point of the fakeFrameGrabber").asFloat64());
92  intrinsic.put("retificationMatrix",config.check("retificationMatrix",*retM,"Matrix that describes the lens' distortion(fake)"));
93  intrinsic.put("distortionModel",config.check("distortionModel",Value("FishEye"),"Reference to group of parameters describing the distortion model of the camera").asString());
94  intrinsic.put("k1",config.check("k1",Value(8.0),"Radial distortion coefficient of the lens(fake)").asFloat64());
95  intrinsic.put("k2",config.check("k2",Value(9.0),"Radial distortion coefficient of the lens(fake)").asFloat64());
96  intrinsic.put("k3",config.check("k3",Value(10.0),"Radial distortion coefficient of the lens(fake)").asFloat64());
97  intrinsic.put("t1",config.check("t1",Value(11.0),"Tangential distortion of the lens(fake)").asFloat64());
98  intrinsic.put("t2",config.check("t2",Value(12.0),"Tangential distortion of the lens(fake)").asFloat64());
99  //Only for debug
100  CameraConfig conf1, conf2, conf3;
101  conf1.height=128; conf1.width=128; conf1.framerate=60.0; conf1.pixelCoding=VOCAB_PIXEL_RGB;
102  conf2.height=256; conf2.width=256; conf2.framerate=30.0; conf2.pixelCoding=VOCAB_PIXEL_BGR;
103  conf3.height=512; conf3.width=512; conf3.framerate=15.0; conf3.pixelCoding=VOCAB_PIXEL_MONO;
104  configurations.push_back(conf1);
105  configurations.push_back(conf2);
106  configurations.push_back(conf3);
107  delete retM;
108 
109  if (config.check("freq",val,"rate of test images in Hz")) {
110  freq = val->asFloat64();
111  period = 1/freq;
112  } else if (config.check("period",val,
113  "period of test images in seconds")) {
114  period = val->asFloat64() / 1000.0;
115  if(period<=0) {
116  period =0;
117  freq = -1;
118  }
119  }
120  mode = config.check("mode",
122  "bouncy [ball], scrolly [line], grid [grid], grid multisize [size], random [rand], none [none], time test[time]").asVocab();
123 
124  if (config.check("src")) {
125  if (!yarp::sig::file::read(background,
126  config.check("src",
127  yarp::os::Value("test.ppm"),
128  "background image to use, if any").asString())) {
129  return false;
130  }
131  if (background.width()>0) {
132  w = background.width();
133  h = background.height();
134  }
135  }
136 
137  use_bayer = config.check("bayer","should emit bayer test image?");
138  use_mono = config.check("mono","should emit a monochrome image?");
139  use_mono = use_mono||use_bayer;
140 
141  if (freq!=-1) {
142  yCInfo(FAKEFRAMEGRABBER,
143  "Test grabber period %g / freq %g , mode [%s]",
144  period,
145  freq,
146  yarp::os::Vocab::decode(mode).c_str());
147  } else {
148  yCInfo(FAKEFRAMEGRABBER,
149  "Test grabber period %g / freq [inf], mode [%s]",
150  period,
151  yarp::os::Vocab::decode(mode).c_str());
152  }
153 
154  bx = w/2;
155  by = h/2;
156  return true;
157 }
158 
160  double now = yarp::os::Time::now();
161 
162  if (now-prev>1000) {
163  first = now;
164  prev = now;
165  }
166  double dt = period-(now-prev);
167 
168  if (dt>0) {
170  }
171 
172  // this is the controlled instant when we consider the
173  // image as going out
174  prev += period;
175 }
176 
178  return h;
179 }
180 
182  return w;
183 }
184 
186  return h;
187 }
188 
190  return w;
191 }
192 
194  configurations=this->configurations;
195  return true;
196 }
197 
198 bool FakeFrameGrabber::getRgbResolution(int &width, int &height){
199  width=w;
200  height=h;
201  return true;
202 }
203 
204 bool FakeFrameGrabber::setRgbResolution(int width, int height){
205  w=width;
206  h=height;
207  return true;
208 }
209 
210 bool FakeFrameGrabber::getRgbFOV(double &horizontalFov, double &verticalFov){
211  horizontalFov=this->horizontalFov;
212  verticalFov=this->verticalFov;
213  return true;
214 }
215 
216 bool FakeFrameGrabber::setRgbFOV(double horizontalFov, double verticalFov){
217  this->horizontalFov=horizontalFov;
218  this->verticalFov=verticalFov;
219  return true;
220 }
221 
223  intrinsic=this->intrinsic;
224  return true;
225 }
226 
228  mirror=this->mirror;
229  return true;}
230 
232  this->mirror=mirror;
233  return true;
234 }
235 
237  timing();
238  createTestImage(image);
239  return true;
240 }
241 
242 
244  timing();
245  createTestImage(rgb_image);
246  if (use_bayer) {
247  makeSimpleBayer(rgb_image,image);
248  } else {
249  image.copy(rgb_image);
250  }
251  return true;
252 }
253 
254 
256  return stamp;
257 }
258 
259 bool FakeFrameGrabber::hasAudio() { return false; }
260 
261 bool FakeFrameGrabber::hasVideo() { return !use_mono; }
262 
264  return use_mono;
265 }
266 
268 bool FakeFrameGrabber::hasFeature(int feature, bool *hasFeature) { return false; }
269 bool FakeFrameGrabber::setFeature(int feature, double value) { return false; }
270 bool FakeFrameGrabber::getFeature(int feature, double *value) { return false; }
271 bool FakeFrameGrabber::setFeature(int feature, double value1, double value2) { return false; }
272 bool FakeFrameGrabber::getFeature(int feature, double *value1, double *value2) { return false; }
273 bool FakeFrameGrabber::hasOnOff(int feature, bool *HasOnOff) { return false; }
274 bool FakeFrameGrabber::setActive(int feature, bool onoff) { return false; }
275 bool FakeFrameGrabber::getActive(int feature, bool *isActive) { return false; }
276 bool FakeFrameGrabber::hasAuto(int feature, bool *hasAuto) { return false; }
277 bool FakeFrameGrabber::hasManual(int feature, bool *hasManual) { return false; }
278 bool FakeFrameGrabber::hasOnePush(int feature, bool *hasOnePush) { return false; }
279 bool FakeFrameGrabber::setMode(int feature, FeatureMode mode) { return false; }
280 bool FakeFrameGrabber::getMode(int feature, FeatureMode *mode) { return false; }
281 bool FakeFrameGrabber::setOnePush(int feature) { return false; }
282 
283 void FakeFrameGrabber::printTime(unsigned char* pixbuf, int pixbuf_w, int pixbuf_h, int x, int y, char* s, int size)
284 {
285  int pixelsize = 5;
286  for (int i = 0; i<size; i++)
287  {
288  char* num_p = nullptr;
289  switch (s[i])
290  {
291  case '0': num_p = num[0].data; break;
292  case '1': num_p = num[1].data; break;
293  case '2': num_p = num[2].data; break;
294  case '3': num_p = num[3].data; break;
295  case '4': num_p = num[4].data; break;
296  case '5': num_p = num[5].data; break;
297  case '6': num_p = num[6].data; break;
298  case '7': num_p = num[7].data; break;
299  case '8': num_p = num[8].data; break;
300  case '9': num_p = num[9].data; break;
301  case ' ': num_p = num[10].data; break;
302  case '.': num_p = num[11].data; break;
303  }
304 
305  for (int yi = 0; yi<5; yi++)
306  for (int xi = 0; xi<3; xi++)
307  {
308  int ii = yi * 3 + xi;
309  if (num_p[ii] == '*')
310  {
311  for (int r = yi * pixelsize; r<yi*pixelsize + pixelsize; r++)
312  {
313  int off = i * (pixelsize + 20);
314  for (int c = xi * pixelsize + off; c<xi*pixelsize + pixelsize + off; c++)
315  {
316  if (c >= pixbuf_h ||
317  r >= pixbuf_w)
318  {
319  //avoid drawing out of the image memory
320  return;
321  }
322  unsigned char *pixel = pixbuf;
323  size_t offset = c * 3 + r * (pixbuf_w * 3);
324  pixel = pixel + offset;
325  pixel[0] = 0;
326  pixel[1] = 0;
327  pixel[2] = 255;
328  }
329  }
330  }
331  }
332  }
333 }
334 
335 void FakeFrameGrabber::createTestImage(yarp::sig::ImageOf<yarp::sig::PixelRgb>&
336  image) {
337  // to test IPreciselyTimed, make timestamps be mysteriously NNN.NNN42
338  double t = Time::now();
339  t -= ((t*1000)-(int)t)/1000;
340  t+= 0.00042;
341  stamp.update(t);
342  if (background.width()>0) {
343  image.copy(background);
344  } else {
345  image.resize(w,h);
346  image.zero();
347  }
348  switch (mode) {
349  case VOCAB_TIMETEXT:
350  {
351  char txtbuf[50];
352  double time = yarp::os::Time::now() - start_time;
353  std::snprintf(txtbuf, 50, "%.3f", time);
354  int len = strlen(txtbuf);
355  if (len < 20)
356  {
357  printTime((unsigned char*)image.getRawImage(), image.width(), image.height(), 0, 0, txtbuf, len);
358  }
359  }
360  break;
361  case VOCAB_BALL:
362  {
363  addCircle(image,PixelRgb{0,255,0},bx,by,15);
364  addCircle(image,PixelRgb{0,255,255},bx,by,8);
365  if (ct%5!=0) {
366  rnd *= 65537;
367  rnd += 17;
368  int delta_x = (rnd % 5) - 2;
369  bx += delta_x;
370  rnd *= 65537;
371  rnd += 17;
372  int delta_y = (rnd % 5) - 2;
373  by += delta_y;
374  } else {
375  int dx = w/2 - bx;
376  int dy = h/2 - by;
377  if (dx>0) { bx++; }
378  if (dx<0) { bx--; }
379  if (dy>0) { by++; }
380  if (dy<0) { by--; }
381  }
382  }
383  break;
384  case VOCAB_GRID:
385  {
386  size_t ww = image.width();
387  size_t hh = image.height();
388  if (ww>1&&hh>1) {
389  for (size_t x=0; x<ww; x++) {
390  for (size_t y=0; y<hh; y++) {
391  double xx = ((double)x)/(ww-1);
392  double yy = ((double)y)/(hh-1);
393  bool act = (y==ct);
394  auto r = static_cast<unsigned char>(0.5 + 255 * xx);
395  auto g = static_cast<unsigned char>(0.5 + 255 * yy);
396  auto b = static_cast<unsigned char>(act * 255);
397  image.pixel(x, y) = PixelRgb{r, g, b};
398  }
399  }
400  }
401  }
402  break;
403  case VOCAB_GRID_MULTISIZE:
404  {
405  static int count = 0;
406  count++;
407  if (count== 100)
408  {
409  yCDebug(FAKEFRAMEGRABBER) << "size 100, 100";
410  image.resize(100,100);
411  }
412  else if (count == 200)
413  {
414  yCDebug(FAKEFRAMEGRABBER) << "size 200, 100";
415  image.resize(200, 100);
416  }
417  else if (count == 300)
418  {
419  yCDebug(FAKEFRAMEGRABBER) << "size 300, 50";
420  image.resize(300, 50);
421  count = 0;
422  }
423 
424  size_t ww = w = image.width();
425  size_t hh = h = image.height();
426  if (ww>1 && hh>1) {
427  for (size_t x = 0; x<ww; x++) {
428  for (size_t y = 0; y<hh; y++) {
429  double xx = ((double)x) / (ww - 1);
430  double yy = ((double)y) / (hh - 1);
431  bool act = (y == ct);
432  auto r = static_cast<unsigned char>(0.5 + 255 * xx);
433  auto g = static_cast<unsigned char>(0.5 + 255 * yy);
434  auto b = static_cast<unsigned char>(act * 255);
435  image.pixel(x, y) = PixelRgb{r, g, b};
436  }
437  }
438  }
439  }
440  break;
441  case VOCAB_LINE:
442  default:
443  {
444  for (size_t i=0; i<image.width(); i++) {
445  image.pixel(i,ct).r = 255;
446  }
447  char ttxt[50];
448  std::snprintf(ttxt, 50, "%021.10f", t);
449  image.pixel(0, 0).r = ttxt[0] - '0';
450  image.pixel(0, 0).g = ttxt[1] - '0';
451  image.pixel(0, 0).b = ttxt[2] - '0';
452 
453  image.pixel(1, 0).r = ttxt[3] - '0';
454  image.pixel(1, 0).g = ttxt[4] - '0';
455  image.pixel(1, 0).b = ttxt[5] - '0';
456 
457  image.pixel(2, 0).r = ttxt[6] - '0';
458  image.pixel(2, 0).g = ttxt[7] - '0';
459  image.pixel(2, 0).b = ttxt[8] - '0';
460 
461  image.pixel(3, 0).r = ttxt[9] - '0';
462  image.pixel(3, 0).g = ttxt[10] - '0';
463  image.pixel(3, 0).b = ttxt[11] - '0';
464 
465  image.pixel(4, 0).r = ttxt[12] - '0';
466  image.pixel(4, 0).g = ttxt[13] - '0';
467  image.pixel(4, 0).b = ttxt[14] - '0';
468 
469  image.pixel(5, 0).r = ttxt[15] - '0';
470  image.pixel(5, 0).g = ttxt[16] - '0';
471  image.pixel(5, 0).b = ttxt[17] - '0';
472 
473  image.pixel(6, 0).r = ttxt[18] - '0';
474  image.pixel(6, 0).g = ttxt[19] - '0';
475  image.pixel(6, 0).b = ttxt[20] - '0';
476  }
477  break;
478  case VOCAB_RAND:
479  {
480  // from Alessandro Scalzo
481 
482  static unsigned char r=128,g=128,b=128;
483 
484  size_t ww = image.width();
485  size_t hh = image.height();
486 
487  if (ww>1&&hh>1) {
488  std::default_random_engine randengine;
489  std::uniform_real_distribution<double> udist(-1.0, 1.0);
490  for (size_t x=0; x<ww; x++) {
491  for (size_t y=0; y<hh; y++) {
492  //r+=(rand()%3)-1;
493  //g+=(rand()%3)-1;
494  //b+=(rand()%3)-1;
495  r += udist(randengine);
496  g += udist(randengine);
497  b += udist(randengine);
498  image.pixel(x,y) = PixelRgb{r,g,b};
499  }
500  }
501  }
502  }
503  break;
504  case VOCAB_NONE:
505  break;
506  }
507  ct++;
508  if (ct>=image.height()) {
509  ct = 0;
510  }
511  if (by>=image.height()) {
512  by = image.height()-1;
513  }
514  if (bx>=image.width()) {
515  bx = image.width()-1;
516  }
517 }
518 
519 
520 
521 // From iCub staticgrabber device.
522 // DF2 bayer sequence.
523 // -- in staticgrabber: first row GBGBGB, second row RGRGRG.
524 // -- changed here to: first row GRGRGR, second row BGBGBG.
525 bool FakeFrameGrabber::makeSimpleBayer(
526  ImageOf<PixelRgb>& img,
527  ImageOf<PixelMono>& bayer) {
528 
529  bayer.resize(img.width(), img.height());
530 
531  const size_t w = img.width();
532  const size_t h = img.height();
533 
534  size_t i, j;
535  for (i = 0; i < h; i++) {
536  auto* row = (PixelRgb *)img.getRow(i);
537  auto* rd = (PixelMono *)bayer.getRow(i);
538 
539  for (j = 0; j < w; j++) {
540 
541  if ((i%2) == 0) {
542  switch (j%4) {
543  case 0:
544  case 2:
545  *rd++ = row->g;
546  row++;
547  break;
548 
549  case 1:
550  case 3:
551  *rd++ = row->r;
552  row++;
553  break;
554  }
555  }
556 
557  if ((i%2) == 1) {
558  switch (j%4) {
559  case 1:
560  case 3:
561  *rd++ = row->g;
562  row++;
563  break;
564 
565  case 0:
566  case 2:
567  *rd++ = row->b;
568  row++;
569  break;
570  }
571  }
572  }
573  }
574 
575  return true;
576 }
577 
579 {
580  yCWarning(FAKEFRAMEGRABBER, "'test_grabber' was renamed 'fakeFrameGrabber'. The old name is still supported for compatibility, but it will be deprecated and removed in a future release. Please update your scripts");
581  return FakeFrameGrabber::open(config);
582 }
LogStream.h
CameraDescriptor
Definition: FrameGrabberInterfaces.h:35
FakeFrameGrabber::setRgbFOV
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
Definition: FakeFrameGrabber.cpp:216
FakeFrameGrabber::hasAuto
bool hasAuto(int feature, bool *hasAuto) override
Check if the requested feature has the 'auto' mode.
Definition: FakeFrameGrabber.cpp:276
FakeFrameGrabber::height
int height() const override
Return the height of each frame.
Definition: FakeFrameGrabber.cpp:177
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
FakeFrameGrabber::hasOnOff
bool hasOnOff(int feature, bool *HasOnOff) override
Check if the camera has the ability to turn on/off the requested feature.
Definition: FakeFrameGrabber.cpp:273
FakeFrameGrabber::getRgbWidth
int getRgbWidth() override
Return the width of each frame.
Definition: FakeFrameGrabber.cpp:189
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
yarp::sig::PixelRgb::g
unsigned char g
Definition: Image.h:455
yarp::sig::file::read
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:827
yarp::os::Value::makeList
static Value * makeList()
Create a list Value.
Definition: Value.cpp:449
yarp::sig
Signal processing.
Definition: Image.h:25
FakeFrameGrabber::setRgbMirroring
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
Definition: FakeFrameGrabber.cpp:231
t
float t
Definition: FfmpegWriter.cpp:74
FakeFrameGrabber::setFeature
bool setFeature(int feature, double value) override
Set the requested feature to a value (saturation, brightness ...
Definition: FakeFrameGrabber.cpp:269
yCWarning
#define yCWarning(component,...)
Definition: LogComponent.h:146
randengine
std::default_random_engine randengine
Definition: Random.cpp:16
FakeFrameGrabber.h
FakeFrameGrabber::hasOnePush
bool hasOnePush(int feature, bool *hasOnePush) override
Check if the requested feature has the 'onePush' mode.
Definition: FakeFrameGrabber.cpp:278
FakeFrameGrabber::getImage
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an rgb image from the frame grabber, if required demosaicking/color reconstruction is applied.
Definition: FakeFrameGrabber.cpp:236
YARP_LOG_COMPONENT
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:80
FakeFrameGrabber::hasFeature
bool hasFeature(int feature, bool *hasFeature) override
Check if camera has the requested feature (saturation, brightness ...
Definition: FakeFrameGrabber.cpp:268
TestFrameGrabber::open
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
Definition: FakeFrameGrabber.cpp:578
ImageDraw.h
yarp::os::Time::now
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition: Time.cpp:124
yarp::dev
An interface for the device drivers.
Definition: audioBufferSizeData.cpp:17
yarp::dev::CameraConfig::height
int height
Definition: IVisualParams.h:35
yarp::sig::PixelRgb::b
unsigned char b
Definition: Image.h:456
yarp::sig::ImageOf< yarp::sig::PixelRgb >
yarp::os::Vocab::decode
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
Definition: Vocab.cpp:36
yarp::sig::VectorOf
Provides:
Definition: Vector.h:122
yarp::dev::CameraConfig::width
int width
Definition: IVisualParams.h:34
yarp::sig::PixelMono
unsigned char PixelMono
Monochrome pixel type.
Definition: Image.h:436
FakeFrameGrabber::setActive
bool setActive(int feature, bool onoff) override
Set the requested feature on or off.
Definition: FakeFrameGrabber.cpp:274
FakeFrameGrabber::hasManual
bool hasManual(int feature, bool *hasManual) override
Check if the requested feature has the 'manual' mode.
Definition: FakeFrameGrabber.cpp:277
FakeFrameGrabber::getCameraDescription
bool getCameraDescription(CameraDescriptor *camera) override
Get a basic description of the camera hw.
Definition: FakeFrameGrabber.cpp:267
yarp::dev::CameraConfig::framerate
double framerate
Definition: IVisualParams.h:36
yarp::os::Searchable::check
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
FakeFrameGrabber::open
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
Definition: FakeFrameGrabber.cpp:73
FakeFrameGrabber::getRgbResolution
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
Definition: FakeFrameGrabber.cpp:198
FakeFrameGrabber::close
bool close() override
Close the DeviceDriver.
Definition: FakeFrameGrabber.cpp:69
FakeFrameGrabber::getRgbIntrinsicParam
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
Definition: FakeFrameGrabber.cpp:222
FakeFrameGrabber::getLastInputStamp
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
Definition: FakeFrameGrabber.cpp:255
FakeFrameGrabber::setOnePush
bool setOnePush(int feature) override
Set the requested feature to a value (saturation, brightness ...
Definition: FakeFrameGrabber.cpp:281
LogComponent.h
yarp::sig::draw
Very basic drawing functions, in case you don't have anything better available.
Definition: ImageDraw.h:26
FakeFrameGrabber
fakeFrameGrabber: A fake camera for testing.
Definition: FakeFrameGrabber.h:45
yarp::sig::ImageOf::pixel
T & pixel(size_t x, size_t y)
Definition: Image.h:663
FakeFrameGrabber::hasRawVideo
bool hasRawVideo() override
Definition: FakeFrameGrabber.cpp:263
yarp::os::Stamp
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25
FakeFrameGrabber::getActive
bool getActive(int feature, bool *isActive) override
Get the current status of the feature, on or off.
Definition: FakeFrameGrabber.cpp:275
yarp::dev::CameraConfig
Struct describing a possible camera configuration.
Definition: IVisualParams.h:33
FakeFrameGrabber::hasAudio
bool hasAudio() override
Definition: FakeFrameGrabber.cpp:259
yCInfo
#define yCInfo(component,...)
Definition: LogComponent.h:135
VOCAB_PIXEL_MONO
@ VOCAB_PIXEL_MONO
Definition: Image.h:48
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
yCDebug
#define yCDebug(component,...)
Definition: LogComponent.h:112
FeatureMode
FeatureMode
Definition: FrameGrabberInterfaces.h:29
yarp::sig::PixelRgb
Packed RGB pixel type.
Definition: Image.h:453
FakeFrameGrabber::setMode
bool setMode(int feature, FeatureMode mode) override
Set the requested mode for the feature.
Definition: FakeFrameGrabber.cpp:279
FakeFrameGrabber::getRgbSupportedConfigurations
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
Definition: FakeFrameGrabber.cpp:193
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::sig::draw::addCircle
void addCircle(ImageOf< T > &dest, const T &pix, int i, int j, int r)
Definition: ImageDraw.h:43
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
FakeFrameGrabber::getFeature
bool getFeature(int feature, double *value) override
Get the current value for the requested feature.
Definition: FakeFrameGrabber.cpp:270
FakeFrameGrabber::getRgbHeight
int getRgbHeight() override
Return the height of each frame.
Definition: FakeFrameGrabber.cpp:185
FakeFrameGrabber::width
int width() const override
Return the width of each frame.
Definition: FakeFrameGrabber.cpp:181
FakeFrameGrabber::hasVideo
bool hasVideo() override
Definition: FakeFrameGrabber.cpp:261
VOCAB_PIXEL_RGB
@ VOCAB_PIXEL_RGB
Definition: Image.h:50
FakeFrameGrabber::getRgbMirroring
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
Definition: FakeFrameGrabber.cpp:227
FakeFrameGrabber::getRgbFOV
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
Definition: FakeFrameGrabber.cpp:210
yarp::dev::CameraConfig::pixelCoding
YarpVocabPixelTypesEnum pixelCoding
Definition: IVisualParams.h:37
FakeFrameGrabber::setRgbResolution
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
Definition: FakeFrameGrabber.cpp:204
FakeFrameGrabber::getMode
bool getMode(int feature, FeatureMode *mode) override
Get the current mode for the feature.
Definition: FakeFrameGrabber.cpp:280
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
FakeFrameGrabber::timing
void timing()
Definition: FakeFrameGrabber.cpp:159
yarp::os::Value::asFloat64
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:225
VOCAB_PIXEL_BGR
@ VOCAB_PIXEL_BGR
Definition: Image.h:55
yarp::os::Time::delay
void delay(double seconds)
Wait for a certain number of seconds.
Definition: Time.cpp:114
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37
VOCAB_LINE
constexpr yarp::conf::vocab32_t VOCAB_LINE
Definition: FakeFrameGrabber.h:27
yarp::sig::PixelRgb::r
unsigned char r
Definition: Image.h:454