YARP
Yet Another Robot Platform
Image.h
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 #ifndef YARP_SIG_IMAGE_H
11 #define YARP_SIG_IMAGE_H
12 
13 #include <yarp/conf/system.h>
14 #include <yarp/os/NetUint16.h>
15 #include <yarp/os/Portable.h>
16 #include <yarp/os/Type.h>
17 #include <yarp/os/Vocab.h>
18 #include <yarp/sig/api.h>
19 #include <map>
20 
21 namespace yarp {
25  namespace sig {
26  class Image;
27  class FlexImage;
28  template <class T> class ImageOf;
29 
36  inline size_t PAD_BYTES (size_t len, size_t pad) {
37  const size_t rem = len % pad;
38  return (rem != 0) ? (pad - rem) : rem;
39  }
40  }
41 }
42 
43 // the image types partially reflect the IPL image types.
44 // There must be a pixel type for every ImageType entry.
46 {
74 };
75 
86 
87 public:
88 
93  Image();
94 
100  Image(const Image& alt);
101 
107  Image(Image&& other) noexcept;
108 
114  Image& operator=(const Image& alt);
115 
122  Image& operator=(Image &&other) noexcept;
123 
127  ~Image() override;
128 
129 
135  bool copy(const Image& alt);
136 
137 
146  bool copy(const Image& alt, size_t w, size_t h);
147 
148 
153  inline size_t width() const { return imgWidth; }
154 
159  inline size_t height() const { return imgHeight; }
160 
165  virtual size_t getPixelSize() const;
166 
173  virtual int getPixelCode() const;
174 
179  inline size_t getRowSize() const { return imgRowSize; }
180 
181 
186  inline size_t getQuantum() const { return imgQuantum; }
187 
192  inline size_t getPadding() const
193  {
194  const size_t ret=imgRowSize-imgWidth*imgPixelSize;
195  return ret;
196  }
197 
203  inline unsigned char *getRow(size_t r)
204  {
205  // should we check limits?
206  return reinterpret_cast<unsigned char *>(data[r]);
207  }
208 
215  inline const unsigned char *getRow(size_t r) const
216  {
217  // should we check limits?
218  return reinterpret_cast<const unsigned char *>(data[r]);
219  }
220 
227  inline unsigned char *getPixelAddress(size_t x, size_t y) const {
228  return reinterpret_cast<unsigned char *>(data[y] + x*imgPixelSize);
229  }
230 
237  inline bool isPixel(size_t x, size_t y) const {
238  return (x<imgWidth && y<imgHeight);
239  }
240 
244  void zero();
245 
255  void resize(size_t imgWidth, size_t imgHeight);
256 
262  void resize(const Image& alt) {
263  resize(alt.width(),alt.height());
264  }
265 
271  void setExternal(const void *data, size_t imgWidth, size_t imgHeight);
272 
277  unsigned char *getRawImage() const;
278 
283  size_t getRawImageSize() const;
284 
285 #ifndef YARP_NO_DEPRECATED // Since YARP 3.2.0
286 
292  YARP_DEPRECATED_MSG("Use yarp::cv::toCvMat instead")
293  void *getIplImage();
294 
301  YARP_DEPRECATED_MSG("Use yarp::cv::toCvMat instead")
302  const void *getIplImage() const;
303 
315  YARP_DEPRECATED_MSG("Use yarp::cv::fromCvMat instead")
316  void wrapIplImage(void *iplImage);
317 #endif // YARP_NO_DEPRECATED
318 
319  //void wrapRawImage(void *buf, int imgWidth, int imgHeight);
320 
321 
326  bool read(yarp::os::ConnectionReader& connection) override;
327 
332  bool write(yarp::os::ConnectionWriter& connection) const override;
333 
334  void setQuantum(size_t imgQuantum);
335 
340  bool topIsLowIndex() const {
341  return topIsLow;
342  }
343 
352  void setTopIsLowIndex(bool flag) {
353  topIsLow = flag;
354  }
355 
356 
361  char **getRowArray() {
362  return data;
363  }
364 
365  yarp::os::Type getReadType() const override {
366  return yarp::os::Type::byName("yarp/image");
367  }
368 
369 protected:
370 
371  void setPixelCode(int imgPixelCode);
372 
373  //pixelCode and pixelsSize should be linked together consistently.
374  //since setPixelCode set also the corresponding pixelSize setPixelSize should not be used at all except for
375  //setting an arbitrary pixelSize with no corresponding pixel code (in that case the pixelCode will be set to -pixelSize).
376  void setPixelSize(size_t imgPixelSize);
377 
378 
379 private:
381  static const std::map<YarpVocabPixelTypesEnum, size_t> pixelCode2Size;
382  size_t imgWidth, imgHeight, imgPixelSize, imgRowSize, imgQuantum;
383  int imgPixelCode;
384  bool topIsLow;
385 
386  char **data;
387  void *implementation;
388 
389  void synchronize();
390  void initialize();
391 
392  void copyPixels(const unsigned char *src, size_t id1,
393  unsigned char *dest, size_t id2, size_t w, size_t h,
394  size_t imageSize, size_t quantum1, size_t quantum2,
395  bool topIsLow1, bool topIsLow2);
396 };
397 
398 
404 public:
405 
406  void setPixelCode(int imgPixelCode) {
407  Image::setPixelCode(imgPixelCode);
408  }
409 
410 
411  void setPixelSize(size_t imgPixelSize) {
412  Image::setPixelSize(imgPixelSize);
413  //pixelCode and pixelsSize should be linked together consistently.
414  //since setPixelCode set also the corresponding pixelSize setPixelSize should not be used at all except for
415  //setting an arbitrary pixelSize with no corresponding pixel code (in that case the pixelCode will be set to -pixelSize).
416  }
417 
418  void setQuantum(size_t imgQuantum) {
419  Image::setQuantum(imgQuantum);
420  }
421 
422 private:
423 };
424 
425 
426 
427 
428 #include <yarp/os/NetInt32.h>
429 
430 namespace yarp {
431  namespace sig {
432 
436  typedef unsigned char PixelMono;
437 
442 
447 
453  {
454  unsigned char r{0}; // NOLINT(misc-non-private-member-variables-in-classes)
455  unsigned char g{0}; // NOLINT(misc-non-private-member-variables-in-classes)
456  unsigned char b{0}; // NOLINT(misc-non-private-member-variables-in-classes)
457 
458  PixelRgb() = default;
459  PixelRgb(unsigned char n_r,
460  unsigned char n_g,
461  unsigned char n_b) :
462  r(n_r),
463  g(n_g),
464  b(n_b)
465  {
466  }
467  };
469 
475  {
476  PixelRgba() = default;
477  PixelRgba(unsigned char n_r,
478  unsigned char n_g,
479  unsigned char n_b,
480  unsigned char n_a) :
481  r(n_r),
482  g(n_g),
483  b(n_b),
484  a(n_a)
485  {
486  }
487 
488  unsigned char r{0}; // NOLINT(misc-non-private-member-variables-in-classes)
489  unsigned char g{0}; // NOLINT(misc-non-private-member-variables-in-classes)
490  unsigned char b{0}; // NOLINT(misc-non-private-member-variables-in-classes)
491  unsigned char a{0}; // NOLINT(misc-non-private-member-variables-in-classes)
492  };
494 
500  {
501  unsigned char b{0}; // NOLINT(misc-non-private-member-variables-in-classes)
502  unsigned char g{0}; // NOLINT(misc-non-private-member-variables-in-classes)
503  unsigned char r{0}; // NOLINT(misc-non-private-member-variables-in-classes)
504  unsigned char a{0}; // NOLINT(misc-non-private-member-variables-in-classes)
505 
506  PixelBgra() = default;
507  PixelBgra(unsigned char n_r,
508  unsigned char n_g,
509  unsigned char n_b,
510  unsigned char n_a) :
511  b(n_b),
512  g(n_g),
513  r(n_r),
514  a(n_a)
515  {
516  }
517  };
519 
525  {
526  unsigned char b{0}; // NOLINT(misc-non-private-member-variables-in-classes)
527  unsigned char g{0}; // NOLINT(misc-non-private-member-variables-in-classes)
528  unsigned char r{0}; // NOLINT(misc-non-private-member-variables-in-classes)
529 
530  PixelBgr() = default;
531  PixelBgr(unsigned char n_r, unsigned char n_g, unsigned char n_b) :
532  b(n_b),
533  g(n_g),
534  r(n_r)
535  {
536  }
537  };
539 
545  {
546  unsigned char h{0};
547  unsigned char s{0};
548  unsigned char v{0};
549  };
551 
555  typedef char PixelMonoSigned;
556 
562  {
563  char r{0};
564  char g{0};
565  char b{0};
566  };
568 
572  typedef float PixelFloat;
573 
579  {
580  float r{0.0F}; // NOLINT(misc-non-private-member-variables-in-classes)
581  float g{0.0F}; // NOLINT(misc-non-private-member-variables-in-classes)
582  float b{0.0F}; // NOLINT(misc-non-private-member-variables-in-classes)
583 
584  PixelRgbFloat() = default;
585  PixelRgbFloat(float n_r,
586  float n_g,
587  float n_b) :
588  r(n_r),
589  g(n_g),
590  b(n_b)
591  {
592  }
593  };
595 
601  {
602  yarp::os::NetInt32 r{0}; // NOLINT(misc-non-private-member-variables-in-classes)
603  yarp::os::NetInt32 g{0}; // NOLINT(misc-non-private-member-variables-in-classes)
604  yarp::os::NetInt32 b{0}; // NOLINT(misc-non-private-member-variables-in-classes)
605 
606  PixelRgbInt() = default;
607  PixelRgbInt(int n_r,
608  int n_g,
609  int n_b) :
610  r(n_r),
611  g(n_g),
612  b(n_b)
613  {
614  }
615  };
617 
623  {
624  float h{0.0F};
625  float s{0.0F};
626  float v{0.0F};
627  };
629  }
630 }
631 
632 
645 template <class T>
646 class yarp::sig::ImageOf : public Image
647 {
648 private:
649  T nullPixel;
650 public:
651  ImageOf() : Image(),
652  nullPixel()
653  {
654  setPixelCode(getPixelCode());
655  }
656 
657  size_t getPixelSize() const override {
658  return sizeof(T);
659  }
660 
661  int getPixelCode() const override;
662 
663  inline T& pixel(size_t x, size_t y) {
664  return *(reinterpret_cast<T*>(getPixelAddress(x,y)));
665  }
666 
667  inline T& pixel(size_t x, size_t y) const {
668  return *(reinterpret_cast<T*>(getPixelAddress(x,y)));
669  }
670 
671  inline const T& operator()(size_t x, size_t y) const {
672  return pixel(x,y);
673  }
674 
675  inline T& operator()(size_t x, size_t y) {
676  return pixel(x,y);
677  }
678 
679  inline T& safePixel(size_t x, size_t y) {
680  if (!isPixel(x,y)) { return nullPixel; }
681  return *(reinterpret_cast<T*>(getPixelAddress(x,y)));
682  }
683 
684  inline const T& safePixel(size_t x, size_t y) const {
685  if (!isPixel(x,y)) { return nullPixel; }
686  return *(reinterpret_cast<T*>(getPixelAddress(x,y)));
687  }
688 };
689 
690 namespace yarp {
691 namespace sig {
692 
693 template<>
695  return VOCAB_PIXEL_MONO;
696 }
697 
698 template<>
700  return VOCAB_PIXEL_MONO16;
701 }
702 
703 template<>
705  return VOCAB_PIXEL_RGB;
706 }
707 
708 template<>
710  return VOCAB_PIXEL_RGBA;
711 }
712 
713 template<>
715  return VOCAB_PIXEL_HSV;
716 }
717 
718 template<>
720  return VOCAB_PIXEL_BGR;
721 }
722 
723 template<>
725  return VOCAB_PIXEL_BGRA;
726 }
727 
728 template<>
731 }
732 
733 template<>
735  return VOCAB_PIXEL_RGB_SIGNED;
736 }
737 
738 template<>
740  return VOCAB_PIXEL_MONO_FLOAT;
741 }
742 
743 template<>
745  return VOCAB_PIXEL_RGB_FLOAT;
746 }
747 
748 template<>
750  return VOCAB_PIXEL_RGB_INT;
751 }
752 
753 template<>
755  return VOCAB_PIXEL_HSV_FLOAT;
756 }
757 
758 template<>
760  return VOCAB_PIXEL_INT;
761 }
762 
763 template<typename T>
764 inline int ImageOf<T>::getPixelCode() const {
765  return -(static_cast<int>(sizeof(T)));
766 }
767 
768 } // namespace sig
769 } // namespace yarp
770 
771 #endif // YARP_SIG_IMAGE_H
yarp::sig::Image::setPixelCode
void setPixelCode(int imgPixelCode)
Definition: Image.cpp:504
yarp::sig::Image::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write image to a connection.
Definition: Image.cpp:772
VOCAB_PIXEL_RGB_INT
@ VOCAB_PIXEL_RGB_INT
Definition: Image.h:58
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
yarp::os::Portable
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:29
VOCAB_PIXEL_RGB_FLOAT
@ VOCAB_PIXEL_RGB_FLOAT
Definition: Image.h:60
yarp::sig::PixelRgb::PixelRgb
PixelRgb()=default
yarp::sig::Image::setPixelSize
void setPixelSize(size_t imgPixelSize)
Definition: Image.cpp:496
yarp::cv::toCvMat
::cv::Mat toCvMat(yarp::sig::ImageOf< T > &yarpImage)
Convert a yarp::sig::ImageOf to a cv::Mat object.
api.h
yarp::sig::PixelRgba::PixelRgba
PixelRgba(unsigned char n_r, unsigned char n_g, unsigned char n_b, unsigned char n_a)
Definition: Image.h:477
yarp::sig::Image::isPixel
bool isPixel(size_t x, size_t y) const
Check whether a coordinate lies within the image.
Definition: Image.h:237
YARP_END_PACK
#define YARP_END_PACK
Ends 1 byte packing for structs/classes.
Definition: system.h:194
VOCAB_PIXEL_RGB_SIGNED
@ VOCAB_PIXEL_RGB_SIGNED
Definition: Image.h:57
yarp::os::Type
Definition: Type.h:24
NetInt32.h
yarp::sig::Image::zero
void zero()
Set all pixels to 0.
Definition: Image.cpp:459
yarp::sig::Image::operator=
Image & operator=(const Image &alt)
Assignment operator.
Definition: Image.cpp:833
VOCAB_PIXEL_ENCODING_BAYER_BGGR16
@ VOCAB_PIXEL_ENCODING_BAYER_BGGR16
Definition: Image.h:65
yarp::sig::PixelRgbFloat::PixelRgbFloat
PixelRgbFloat(float n_r, float n_g, float n_b)
Definition: Image.h:585
YARP_BEGIN_PACK
#define YARP_BEGIN_PACK
Starts 1 byte packing for structs/classes.
Definition: system.h:193
Portable.h
yarp::sig::ImageOf::ImageOf
ImageOf()
Definition: Image.h:651
yarp::sig::PixelHsvFloat::v
float v
Definition: Image.h:626
yarp::sig::Image::getQuantum
size_t getQuantum() const
The size of a row is constrained to be a multiple of the "quantum".
Definition: Image.h:186
yarp::sig::PixelMonoSigned
char PixelMonoSigned
Signed byte pixel type.
Definition: Image.h:555
yarp::sig::PixelRgbInt::PixelRgbInt
PixelRgbInt()=default
yarp::sig::ImageOf::pixel
T & pixel(size_t x, size_t y) const
Definition: Image.h:667
YARP_SUPPRESS_DLL_INTERFACE_WARNING
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING
Suppress MSVC C4251 warning for the next line.
Definition: system.h:338
yarp::sig::PAD_BYTES
size_t PAD_BYTES(size_t len, size_t pad)
computes the padding of YARP images.
Definition: Image.h:36
yarp::sig::PixelBgr
Packed RGB pixel type, with pixels stored in reverse order.
Definition: Image.h:525
yarp::sig::PixelRgbSigned
Signed, packed RGB pixel type.
Definition: Image.h:562
yarp::sig::Image::copy
bool copy(const Image &alt)
Copy operator.
Definition: Image.cpp:842
yarp::sig::Image::~Image
~Image() override
Destructor.
Definition: Image.cpp:441
ret
bool ret
Definition: ImplementAxisInfo.cpp:72
yarp::sig::PixelHsvFloat::s
float s
Definition: Image.h:625
yarp::sig::PixelBgra
Packed BGRA pixel type.
Definition: Image.h:500
yarp::sig::PixelHsvFloat
Floating point HSV pixel type.
Definition: Image.h:623
yarp::sig::Image::read
bool read(yarp::os::ConnectionReader &connection) override
Read image from a connection.
Definition: Image.cpp:665
yarp::sig::Image::getPixelSize
virtual size_t getPixelSize() const
Gets pixel size in memory in bytes.
Definition: Image.cpp:449
yarp::sig::Image::getRawImageSize
size_t getRawImageSize() const
Access to the internal buffer size information (this is how much memory has been allocated for the im...
Definition: Image.cpp:543
VOCAB_PIXEL_ENCODING_BAYER_RGGB8
@ VOCAB_PIXEL_ENCODING_BAYER_RGGB8
Definition: Image.h:68
yarp::sig::Image::Image
Image()
Default constructor.
Definition: Image.cpp:424
yarp::sig::Image::getRowSize
size_t getRowSize() const
Size of the underlying image buffer rows.
Definition: Image.h:179
yarp::sig::Image::width
size_t width() const
Gets width of image in pixels.
Definition: Image.h:153
VOCAB_PIXEL_RGBA
@ VOCAB_PIXEL_RGBA
Definition: Image.h:51
yarp::sig::PixelRgbInt
Integer RGB pixel type.
Definition: Image.h:601
yarp::sig::ImageOf
Typed image class.
Definition: Image.h:647
yarp::sig::Image::setExternal
void setExternal(const void *data, size_t imgWidth, size_t imgHeight)
Use this to wrap an external image.
Definition: Image.cpp:878
yarp::sig::Image::topIsLowIndex
bool topIsLowIndex() const
Definition: Image.h:340
yarp::sig::PixelRgba::PixelRgba
PixelRgba()=default
yarp::sig::ImageOf::safePixel
T & safePixel(size_t x, size_t y)
Definition: Image.h:679
yarp::sig::FlexImage::setQuantum
void setQuantum(size_t imgQuantum)
Definition: Image.h:418
VOCAB_PIXEL_HSV_FLOAT
@ VOCAB_PIXEL_HSV_FLOAT
Definition: Image.h:61
yarp::sig::ImageOf::operator()
T & operator()(size_t x, size_t y)
Definition: Image.h:675
NetUint16.h
yarp::sig::ImageOf::safePixel
const T & safePixel(size_t x, size_t y) const
Definition: Image.h:684
yarp::sig::PixelBgra::PixelBgra
PixelBgra()=default
VOCAB_PIXEL_YUV_422
@ VOCAB_PIXEL_YUV_422
Definition: Image.h:72
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::sig::ImageOf::operator()
const T & operator()(size_t x, size_t y) const
Definition: Image.h:671
Type.h
yarp::sig::PixelMono
unsigned char PixelMono
Monochrome pixel type.
Definition: Image.h:436
yarp::sig::PixelFloat
float PixelFloat
Floating point pixel type.
Definition: Image.h:572
yarp::sig::PixelHsvFloat::h
float h
Definition: Image.h:624
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::sig::PixelRgb::PixelRgb
PixelRgb(unsigned char n_r, unsigned char n_g, unsigned char n_b)
Definition: Image.h:459
VOCAB_PIXEL_YUV_420
@ VOCAB_PIXEL_YUV_420
Definition: Image.h:70
yarp::sig::FlexImage
Image class with user control of representation details.
Definition: Image.h:403
VOCAB_PIXEL_ENCODING_BAYER_RGGB16
@ VOCAB_PIXEL_ENCODING_BAYER_RGGB16
Definition: Image.h:69
yarp::sig::Image::getPixelAddress
unsigned char * getPixelAddress(size_t x, size_t y) const
Get address of a pixel in memory.
Definition: Image.h:227
yarp::sig::FlexImage::setPixelCode
void setPixelCode(int imgPixelCode)
Definition: Image.h:406
yarp::sig::Image::getRow
const unsigned char * getRow(size_t r) const
Get the address of a the first byte of a row in memory, const versions.
Definition: Image.h:215
yarp::sig::PixelInt
yarp::os::NetInt32 PixelInt
32-bit integer pixel type.
Definition: Image.h:446
yarp::sig::Image::getRow
unsigned char * getRow(size_t r)
Get the address of a the first byte of a row in memory.
Definition: Image.h:203
VOCAB_PIXEL_YUV_444
@ VOCAB_PIXEL_YUV_444
Definition: Image.h:71
VOCAB_PIXEL_ENCODING_BAYER_GBRG16
@ VOCAB_PIXEL_ENCODING_BAYER_GBRG16
Definition: Image.h:67
yarp::sig::PixelBgr::PixelBgr
PixelBgr(unsigned char n_r, unsigned char n_g, unsigned char n_b)
Definition: Image.h:531
VOCAB_PIXEL_BGRA
@ VOCAB_PIXEL_BGRA
Definition: Image.h:52
yarp::cv::fromCvMat
yarp::sig::ImageOf< T > fromCvMat(::cv::Mat &cvImage)
Convert a cv::Mat to a yarp::sig::ImageOf object.
Definition: Cv-inl.h:91
yarp::sig::Image::resize
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:466
yarp::sig::Image::height
size_t height() const
Gets height of image in pixels.
Definition: Image.h:159
yarp::sig::PixelHsv
Packed HSV (hue/saturation/value pixel type.
Definition: Image.h:545
yarp::sig::Image::setTopIsLowIndex
void setTopIsLowIndex(bool flag)
control whether image has origin at top left (default) or bottom left.
Definition: Image.h:352
VOCAB_PIXEL_ENCODING_BAYER_GRBG16
@ VOCAB_PIXEL_ENCODING_BAYER_GRBG16
Definition: Image.h:63
YARP_sig_API
#define YARP_sig_API
Definition: api.h:19
VOCAB_PIXEL_ENCODING_BAYER_GBRG8
@ VOCAB_PIXEL_ENCODING_BAYER_GBRG8
Definition: Image.h:66
VOCAB_PIXEL_INVALID
@ VOCAB_PIXEL_INVALID
Definition: Image.h:47
system.h
VOCAB_PIXEL_MONO_SIGNED
@ VOCAB_PIXEL_MONO_SIGNED
Definition: Image.h:56
yarp::sig::ImageOf::pixel
T & pixel(size_t x, size_t y)
Definition: Image.h:663
yarp::sig::PixelRgbFloat::PixelRgbFloat
PixelRgbFloat()=default
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::sig::PixelRgba
Packed RGBA pixel type.
Definition: Image.h:475
yarp::sig::PixelRgbInt::PixelRgbInt
PixelRgbInt(int n_r, int n_g, int n_b)
Definition: Image.h:607
VOCAB_PIXEL_INT
@ VOCAB_PIXEL_INT
Definition: Image.h:53
VOCAB_PIXEL_MONO
@ VOCAB_PIXEL_MONO
Definition: Image.h:48
yarp::sig::PixelRgbFloat
Floating point RGB pixel type.
Definition: Image.h:579
YARP_DEPRECATED_MSG
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2873
yarp::sig::PixelRgb
Packed RGB pixel type.
Definition: Image.h:453
yarp::sig::PixelMono16
yarp::os::NetUint16 PixelMono16
16-bit monochrome pixel type.
Definition: Image.h:441
yarp::os::NetUint16
std::uint16_t NetUint16
Definition of the NetUint16 type.
Definition: NetUint16.h:33
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::sig::Image::getPadding
size_t getPadding() const
Returns the number of padding bytes.
Definition: Image.h:192
yarp::sig::Image
Base class for storing images.
Definition: Image.h:85
Vocab.h
yarp::sig::Image::getReadType
yarp::os::Type getReadType() const override
Definition: Image.h:365
VOCAB_PIXEL_RGB
@ VOCAB_PIXEL_RGB
Definition: Image.h:50
yarp::sig::ImageOf::getPixelCode
int getPixelCode() const override
Definition: Image.h:764
implementation
RandScalar * implementation(void *t)
Definition: RandnScalar.cpp:20
yarp::sig::Image::getRowArray
char ** getRowArray()
Get an array of pointers to the rows of the image.
Definition: Image.h:361
VOCAB_PIXEL_YUV_411
@ VOCAB_PIXEL_YUV_411
Definition: Image.h:73
YarpVocabPixelTypesEnum
YarpVocabPixelTypesEnum
Definition: Image.h:46
yarp::sig::Image::resize
void resize(const Image &alt)
Reallocate the size of the image to match another, throwing away the actual content of the image.
Definition: Image.h:262
VOCAB_PIXEL_ENCODING_BAYER_BGGR8
@ VOCAB_PIXEL_ENCODING_BAYER_BGGR8
Definition: Image.h:64
VOCAB_PIXEL_MONO16
@ VOCAB_PIXEL_MONO16
Definition: Image.h:49
VOCAB_PIXEL_BGR
@ VOCAB_PIXEL_BGR
Definition: Image.h:55
yarp::sig::PixelBgra::PixelBgra
PixelBgra(unsigned char n_r, unsigned char n_g, unsigned char n_b, unsigned char n_a)
Definition: Image.h:507
yarp::sig::FlexImage::setPixelSize
void setPixelSize(size_t imgPixelSize)
Definition: Image.h:411
yarp::sig::Image::getRawImage
unsigned char * getRawImage() const
Access to the internal image buffer.
Definition: Image.cpp:534
yarp::sig::ImageOf::getPixelSize
size_t getPixelSize() const override
Definition: Image.h:657
VOCAB_PIXEL_HSV
@ VOCAB_PIXEL_HSV
Definition: Image.h:54
yarp::sig::PixelBgr::PixelBgr
PixelBgr()=default
VOCAB_PIXEL_ENCODING_BAYER_GRBG8
@ VOCAB_PIXEL_ENCODING_BAYER_GRBG8
Definition: Image.h:62
VOCAB_PIXEL_MONO_FLOAT
@ VOCAB_PIXEL_MONO_FLOAT
Definition: Image.h:59
yarp::sig::Image::setQuantum
void setQuantum(size_t imgQuantum)
Definition: Image.cpp:510
yarp::os::NetInt32
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:33
yarp::sig::Image::getPixelCode
virtual int getPixelCode() const
Gets pixel type identifier.
Definition: Image.cpp:454