|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
22 "yarp.carrier.portmonitor.segmentationimage",
33 c.
r = strtol(colorstring.substr(0, 2).c_str(), NULL, 16);
34 c.
g = strtol(colorstring.substr(2, 2).c_str(), NULL, 16);
35 c.
b = strtol(colorstring.substr(4, 2).c_str(), NULL, 16);
132 yCError(SEGMENTATIONIMAGE,
"SegmentationImageConverter: expected type FlexImage but got wrong data type!");
142 "SegmentationImageConverter: expected %s or %s, got %s, not doing any conversion!",
155 outImg.setPixelSize(3);
158 unsigned char* outPixels = outImg.getRawImage();
162 for(
size_t h=0; h<img->
height(); h++)
164 for(
size_t w=0; w<img->
width(); w++)
169 char* inPixels =
reinterpret_cast<char*
> (img->
getRawImage());
170 inVal = (int) inPixels[w + (h * img->
width())];
174 short int* inPixels =
reinterpret_cast<short int*
> (img->
getRawImage());
175 inVal = inPixels[w + (h * img->
width())];
177 int index = inVal % max_colors;
178 outPixels[w*3 + (h * (img->
width()*3 )) + 0] = colormap[index].r;
179 outPixels[w*3 + (h * (img->
width()*3 )) + 1] = colormap[index].g;
180 outPixels[w*3 + (h * (img->
width()*3 )) + 2] = colormap[index].b;
183 th.setPortWriter(&outImg);
void destroy() override
This will be called when the portmonitor object destroyes.
rgbColor string2color(std::string colorstring)
bool setparam(const yarp::os::Property ¶ms) override
This will be called when the portmonitor carrier parameters are set via Yarp admin port.
#define YARP_LOG_COMPONENT(name,...)
Base class for generic things.
size_t width() const
Gets width of image in pixels.
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
bool create(const yarp::os::Property &options) override
This will be called when the dll is properly loaded by the portmonitor carrier.
static LogType minimumPrintLevel()
Get current minimum print level.
size_t height() const
Gets height of image in pixels.
yarp::os::Things & update(yarp::os::Things &thing) override
After data get accpeted in the accept() callback, an instance of that is given to the update function...
bool getparam(yarp::os::Property ¶ms) override
This will be called when the portmonitor carrier parameters are requested via Yarp admin port.
#define yCError(component,...)
An interface to the operating system, including Port based communication.
Base class for storing images.
static LogCallback printCallback()
Get current print callback.
unsigned char * getRawImage() const
Access to the internal image buffer.
A class for storing options and configuration information.
bool accept(yarp::os::Things &thing) override
This will be called when the data reach the portmonitor object.
virtual int getPixelCode() const
Gets pixel type identifier.