YARP
Yet Another Robot Platform
Loading...
Searching...
No Matches
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::sig
{
19
23
YARP_BEGIN_PACK
24
class
ImageNetworkHeader
25
{
26
public
:
27
const
yarp::os::NetInt32
listTag
{
BOTTLE_TAG_LIST
};
28
const
yarp::os::NetInt32
listLen
{4};
29
const
yarp::os::NetInt32
paramNameTag
{
BOTTLE_TAG_VOCAB32
};
30
const
yarp::os::NetInt32
paramName
{
yarp::os::createVocab32
(
'm'
,
'a'
,
't'
)};
31
const
yarp::os::NetInt32
paramIdTag
{
BOTTLE_TAG_VOCAB32
};
32
yarp::os::NetInt32
id
{0};
33
const
yarp::os::NetInt32
paramListTag
{
BOTTLE_TAG_LIST
+
BOTTLE_TAG_INT32
};
34
// WARNING This is 5 and not 6 because quantum and topIsLow are
35
// transmitted in the same 32 bits for compatibility with
36
// YARP 3.4 and older
37
const
yarp::os::NetInt32
paramListLen
{5};
38
yarp::os::NetInt32
depth
{0};
39
yarp::os::NetInt32
imgSize
{0};
40
yarp::os::NetInt16
quantum
{0};
41
// WARNING The topIsLowIndex field in the ImageNetworkHeader is `0` for
42
// `true` and `1` for `false` for compatibility with YARP 3.4
43
// and older
44
yarp::os::NetInt16
topIsLow
{0};
45
yarp::os::NetInt32
width
{0};
46
yarp::os::NetInt32
height
{0};
47
const
yarp::os::NetInt32
paramBlobTag
{
BOTTLE_TAG_BLOB
};
48
yarp::os::NetInt32
paramBlobLen
{0};
49
50
void
setFromImage
(
const
Image
&
image
)
51
{
52
id
=
image
.getPixelCode();
53
depth
=
image
.getPixelSize();
54
imgSize
=
image
.getRawImageSize();
55
quantum
=
static_cast<
yarp::os::NetInt16
>
(
image
.getQuantum());
56
topIsLow
= 1;
57
width
=
image
.width();
58
height
=
image
.height();
59
paramBlobLen
=
image
.getRawImageSize();
60
}
61
62
void
setToImage
(
FlexImage
&
image
)
63
{
64
image
.setPixelCode(
id
);
65
//setPixelSize() is already set by setPixelCode
66
image
.setQuantum(
quantum
);
67
image
.resize(
width
,
height
);
68
}
69
};
70
YARP_END_PACK
71
72
}
// namespace yarp::sig
73
74
#endif
// YARP_SIG_IMAGENETWORKHEADER_H
Bottle.h
BOTTLE_TAG_INT32
#define BOTTLE_TAG_INT32
Definition
Bottle.h:21
BOTTLE_TAG_BLOB
#define BOTTLE_TAG_BLOB
Definition
Bottle.h:27
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition
Bottle.h:28
BOTTLE_TAG_VOCAB32
#define BOTTLE_TAG_VOCAB32
Definition
Bottle.h:23
Image.h
NetInt16.h
NetInt32.h
yarp::sig::FlexImage
Image class with user control of representation details.
Definition
Image.h:363
yarp::sig::ImageNetworkHeader
Byte order in image header for network transmission.
Definition
ImageNetworkHeader.h:25
yarp::sig::ImageNetworkHeader::paramIdTag
const yarp::os::NetInt32 paramIdTag
Definition
ImageNetworkHeader.h:31
yarp::sig::ImageNetworkHeader::paramListTag
const yarp::os::NetInt32 paramListTag
Definition
ImageNetworkHeader.h:33
yarp::sig::ImageNetworkHeader::depth
yarp::os::NetInt32 depth
Definition
ImageNetworkHeader.h:38
yarp::sig::ImageNetworkHeader::paramNameTag
const yarp::os::NetInt32 paramNameTag
Definition
ImageNetworkHeader.h:29
yarp::sig::ImageNetworkHeader::setToImage
void setToImage(FlexImage &image)
Definition
ImageNetworkHeader.h:62
yarp::sig::ImageNetworkHeader::listTag
const yarp::os::NetInt32 listTag
Definition
ImageNetworkHeader.h:27
yarp::sig::ImageNetworkHeader::width
yarp::os::NetInt32 width
Definition
ImageNetworkHeader.h:45
yarp::sig::ImageNetworkHeader::quantum
yarp::os::NetInt16 quantum
Definition
ImageNetworkHeader.h:40
yarp::sig::ImageNetworkHeader::height
yarp::os::NetInt32 height
Definition
ImageNetworkHeader.h:46
yarp::sig::ImageNetworkHeader::paramBlobTag
const yarp::os::NetInt32 paramBlobTag
Definition
ImageNetworkHeader.h:47
yarp::sig::ImageNetworkHeader::topIsLow
yarp::os::NetInt16 topIsLow
Definition
ImageNetworkHeader.h:44
yarp::sig::ImageNetworkHeader::paramListLen
const yarp::os::NetInt32 paramListLen
Definition
ImageNetworkHeader.h:37
yarp::sig::ImageNetworkHeader::setFromImage
void setFromImage(const Image &image)
Definition
ImageNetworkHeader.h:50
yarp::sig::ImageNetworkHeader::paramBlobLen
yarp::os::NetInt32 paramBlobLen
Definition
ImageNetworkHeader.h:48
yarp::sig::ImageNetworkHeader::paramName
const yarp::os::NetInt32 paramName
Definition
ImageNetworkHeader.h:30
yarp::sig::ImageNetworkHeader::listLen
const yarp::os::NetInt32 listLen
Definition
ImageNetworkHeader.h:28
yarp::sig::ImageNetworkHeader::imgSize
yarp::os::NetInt32 imgSize
Definition
ImageNetworkHeader.h:39
yarp::sig::Image
Base class for storing images.
Definition
Image.h:79
DumpFormat::image
@ image
yarp::os::NetInt16
std::int16_t NetInt16
Definition of the NetInt16 type.
Definition
NetInt16.h:29
yarp::os::NetInt32
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition
NetInt32.h:29
yarp::os::createVocab32
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:27
yarp::sig
Definition
audioBufferSizeData.cpp:13
system.h
YARP_END_PACK
#define YARP_END_PACK
Ends 1 byte packing for structs/classes.
Definition
system.h:193
YARP_BEGIN_PACK
#define YARP_BEGIN_PACK
Starts 1 byte packing for structs/classes.
Definition
system.h:192
YARP
3.11.100+20250603.4+gitaa77f8b5c
src
libYARP_sig
src
yarp
sig
ImageNetworkHeader.h
Generated on Wed Jun 4 2025 02:40:13 for YARP by
1.9.8