YARP
Yet Another Robot Platform
ImageNetworkHeader.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_SIG_IMAGENETWORKHEADER_H
8 #define YARP_SIG_IMAGENETWORKHEADER_H
9 
10 #include <yarp/conf/system.h>
11 
12 #include <yarp/os/NetInt32.h>
13 #include <yarp/os/NetInt16.h>
14 #include <yarp/os/Bottle.h>
15 
16 #include <yarp/sig/Image.h>
17 
18 namespace yarp {
19 namespace sig {
20 
26 {
27 public:
35  // WARNING This is 5 and not 6 because quantum and topIsLow are
36  // transmitted in the same 32 bits for compatibility with
37  // YARP 3.4 and older
42  // WARNING The topIsLowIndex field in the ImageNetworkHeader is `0` for
43  // `true` and `1` for `false` for compatibility with YARP 3.4
44  // and older
50 
51  void setFromImage(const Image& image)
52  {
53  id = image.getPixelCode();
54  depth = image.getPixelSize();
55  imgSize = image.getRawImageSize();
56  quantum = static_cast<yarp::os::NetInt16>(image.getQuantum());
57  topIsLow = image.topIsLowIndex() ? 0 : 1;
58  width = image.width();
59  height = image.height();
60  paramBlobLen = image.getRawImageSize();
61  }
62 };
64 
65 } // namespace sig
66 } // namespace yarp
67 
68 #endif // YARP_SIG_IMAGENETWORKHEADER_H
#define BOTTLE_TAG_INT32
Definition: Bottle.h:21
#define BOTTLE_TAG_BLOB
Definition: Bottle.h:27
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
#define BOTTLE_TAG_VOCAB32
Definition: Bottle.h:23
Byte order in image header for network transmission.
const yarp::os::NetInt32 paramIdTag
const yarp::os::NetInt32 paramListTag
const yarp::os::NetInt32 paramNameTag
const yarp::os::NetInt32 listTag
const yarp::os::NetInt32 paramBlobTag
const yarp::os::NetInt32 paramListLen
void setFromImage(const Image &image)
const yarp::os::NetInt32 paramName
const yarp::os::NetInt32 listLen
Base class for storing images.
Definition: Image.h:82
bool topIsLowIndex() const
Definition: Image.h:353
size_t width() const
Gets width of image in pixels.
Definition: Image.h:166
virtual size_t getPixelSize() const
Gets pixel size in memory in bytes.
Definition: Image.cpp:435
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:550
size_t getQuantum() const
The size of a row is constrained to be a multiple of the "quantum".
Definition: Image.h:199
size_t height() const
Gets height of image in pixels.
Definition: Image.h:172
virtual int getPixelCode() const
Gets pixel type identifier.
Definition: Image.cpp:440
std::int16_t NetInt16
Definition of the NetInt16 type.
Definition: NetInt16.h:30
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:30
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition: Vocab.h:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_END_PACK
Ends 1 byte packing for structs/classes.
Definition: system.h:191
#define YARP_BEGIN_PACK
Starts 1 byte packing for structs/classes.
Definition: system.h:190