19 "yarp.carrier.portmonitor.segmentationimage_to_rgb",
30 c.
r = strtol(colorstring.substr(0, 2).c_str(), NULL, 16);
31 c.
g = strtol(colorstring.substr(2, 2).c_str(), NULL, 16);
32 c.
b = strtol(colorstring.substr(4, 2).c_str(), NULL, 16);
129 yCError(SEGMENTATIONIMAGE,
"SegmentationImageConverter: expected type FlexImage but got wrong data type!");
139 "SegmentationImageConverter: expected %s or %s, got %s, not doing any conversion!",
159 for(
size_t h=0; h<img->
height(); h++)
161 for(
size_t w=0; w<img->
width(); w++)
166 char* inPixels =
reinterpret_cast<char*
> (img->
getRawImage());
167 inVal = (int) inPixels[w + (h * img->
width())];
171 short int* inPixels =
reinterpret_cast<short int*
> (img->
getRawImage());
172 inVal = inPixels[w + (h * img->
width())];
174 int index = inVal % max_colors;
175 outPixels[w*3 + (h * (img->
width()*3 )) + 0] = colormap[index].r;
176 outPixels[w*3 + (h * (img->
width()*3 )) + 1] = colormap[index].g;
177 outPixels[w*3 + (h * (img->
width()*3 )) + 2] = colormap[index].b;
rgbColor string2color(std::string colorstring)
bool accept(yarp::os::Things &thing) override
This will be called when the data reach the portmonitor object.
void destroy() override
This will be called when the portmonitor object destroyes.
bool setparam(const yarp::os::Property ¶ms) override
This will be called when the portmonitor carrier parameters are set via YARP admin port.
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.
bool create(const yarp::os::Property &options) override
This will be called when the dll is properly loaded by the portmonitor carrier.
static LogCallback printCallback()
Get current print callback.
static LogType minimumPrintLevel()
Get current minimum print level.
A class for storing options and configuration information.
Base class for generic things.
void setPortWriter(yarp::os::PortWriter *writer)
Set the reference to a PortWriter object.
void setPixelCode(int imgPixelCode)
void setPixelSize(size_t imgPixelSize)
Base class for storing images.
size_t width() const
Gets width of image in pixels.
unsigned char * getRawImage() const
Access to the internal image buffer.
void resize(size_t imgWidth, size_t imgHeight)
Reallocate an image to be of a desired size, throwing away its current contents.
void zero()
Set all pixels to 0.
size_t height() const
Gets height of image in pixels.
virtual int getPixelCode() const
Gets pixel type identifier.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
An interface to the operating system, including Port based communication.