YARP
Yet Another Robot Platform
ImageNetworkHeader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 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_IMAGENETWORKHEADER_H
11 #define YARP_SIG_IMAGENETWORKHEADER_H
12 
13 #include <yarp/conf/system.h>
14 
15 #include <yarp/os/NetInt32.h>
16 #include <yarp/os/Bottle.h>
17 
18 #include <yarp/sig/Image.h>
19 
20 namespace yarp {
21  namespace sig {
22  class ImageNetworkHeader;
23  }
24 }
25 
33 {
34 public:
35 
51 
53  paramName(0), paramIdTag(0), id(0),
54  paramListTag(0), paramListLen(0), depth(0),
55  imgSize(0), quantum(0), width(0),
56  height(0), paramBlobTag(0), paramBlobLen(0) {}
57 
58  void setFromImage(const Image& image) {
60  listLen = 4;
62  paramName = yarp::os::createVocab('m','a','t');
64  id = image.getPixelCode();
66  paramListLen = 5;
67  depth = image.getPixelSize();
68  imgSize = image.getRawImageSize();
69  quantum = image.getQuantum();
70  width = image.width();
71  height = image.height();
73  paramBlobLen = image.getRawImageSize();
74  }
75 
76 };
78 
79 #endif // YARP_SIG_IMAGENETWORKHEADER_H
#define BOTTLE_TAG_INT32
Definition: Bottle.h:23
#define BOTTLE_TAG_BLOB
Definition: Bottle.h:29
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
#define BOTTLE_TAG_VOCAB32
Definition: Bottle.h:25
Byte order in image header for network transmission.
void setFromImage(const Image &image)
Base class for storing images.
Definition: Image.h:85
size_t width() const
Gets width of image in pixels.
Definition: Image.h:153
virtual size_t getPixelSize() const
Gets pixel size in memory in bytes.
Definition: Image.cpp:449
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
size_t getQuantum() const
The size of a row is constrained to be a multiple of the "quantum".
Definition: Image.h:186
size_t height() const
Gets height of image in pixels.
Definition: Image.h:159
virtual int getPixelCode() const
Gets pixel type identifier.
Definition: Image.cpp:454
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:33
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
The main, catch-all namespace for YARP.
Definition: environment.h:25
#define YARP_END_PACK
Ends 1 byte packing for structs/classes.
Definition: system.h:194
#define YARP_BEGIN_PACK
Starts 1 byte packing for structs/classes.
Definition: system.h:193