Inverted orientation and color space
When getting an OpenCV image from yarp and then displaying it you get an upside down picture and the red and blue channels are inverted. The point is that OpenCV does a lot of (badly documented) assumptions : actually the cvShowImage function expects an image in 8 bit depth BGR coding !
So here a way to deal with that :
// A new image is acquired and converted into a BGR // IplImage stored into p_ipl_image_in // Reading from YARP yarp_rgb_image_t* tmp_yarp_img = portIn.read(true); // "Converting" into an IplImage (actually just getting the pointer) IplImage* tmp_ipl_image = (IplImage*) tmp_yarp_img->getIplImage(); // Creating a new image of the same size and depth (may be depth should be force to IPL_DEPTH_8U ?) p_ipl_image_in = cvCreateImage( cvSize(tmp_ipl_image->width, tmp_ipl_image->height), tmp_ipl_image->depth, 3 ); // Doing the color conversion which also copies the image in the ne just created cvCvtColor(tmp_ipl_image, p_ipl_image_in, CV_RGB2BGR); // Adjusting origin p_ipl_image_in->origin=0;
There is an other very usefull function in OpenCV cvConveertImage which (tries to) do the right conversion between 2 images on the base f the information contained in the headers...
IplImage *tmp_img; tmp_img = cvCreateImage(img_size, IPL_DEPTH_8U, 1 ); //cvCvtColor(p_ipl_image_in, tmp_img, CV_BGR2GRAY); cvConvertImage(p_ipl_image_in, tmp_img);
Any way OpenCV is a real nightmare of badly or un- documented assumptions (try to do some optical flow stuff just to see ;-) ) and here are some other libraries :
- VXL 
- LTIlib 
- Real C++ and not decorated C
- Well documented and (seemingly) simple to use
- Almost as many algorithms as in OpenCV
- CImg used in Renaud yayarpview 
- Torch  is a very nice learning library, which as recently gained a vision module : don't know anything more about it...