An example of how to receive, process, and output images to and from a port.
int main(
int argc,
char* argv[])
{
BufferedPort<ImageOf<PixelRgb>> port;
Property options;
options.fromCommand(argc, argv);
std::string portName = options.check("name", Value("/worker")).asString();
port.open(portName);
size_t ct = 0;
while (true) {
ImageOf<PixelRgb>* img = port.read();
if (img == nullptr) {
continue;
}
PixelRgb blue{0, 0, 255};
ct = (ct + 5) % img->width();
port.prepare() = *img;
port.write();
}
return 0;
}