The Easiest Way to Save and Share Code Snippets on the web

iCub simulator - display a picture on the projection screen

cpp-qt

posted: Jun, 27th 2011 | jump to bottom

// Display a picture on the projection display
void displayProjectedPicture(QString picturePath) {
 
        BufferedPort<ImageOf<PixelRgb> > screenPort;
	IplImage* screenImage;
 
        screenPort.open("/my_port");
        Network::connect("/my_port", "/icubSim/texture/screen", 0, false);
 
	screenImage = cvLoadImage(picturePath.toAscii(), 1);
        ImageOf<PixelRgb>& out = screenPort.prepare();
        out.wrapIplImage(screenImage);
 
        screenPort.write();
	sleep(0.5);
        screenPort.close();
 
}
128 views