QImage 转 IplImage(imageRGB32 --> originalImage):
QImage imageRGB32(fileName);
QImage image = imageRGB32.convertToFormat(QImage::Format_RGB888);
IplImage *Oimage = cvCreateImageHeader(cvSize(image.width(), image.height()), IPL_DEPTH_8U, 3);
Oimage->imageData = (char *)image.bits();
IplImage *originalImage = cvCreateImage(cvSize(image.width(), image.height()), IPL_DEPTH_8U, 3);
cvConvertImage(Oimage, originalImage, CV_CVTIMG_SWAP_RB);
cvReleaseImageHeader(&Oimage);
IplImage 转 QImage(BGRimage --> Qimage):
IplImage *BGRimage = cvLoadImage(filename, CV_LOAD_IMAGE_COLOR);
IplImage *RGBimage = cvCreateImage(cvSize(BGRimage->width, BGRimage->height), IPL_DEPTH_8U, 3);
cvConvertImage(BGRimage, RGBimage, CV_CVTIMG_SWAP_RB);
QImage Qimage((uchar *)RGBimage->imageData, RGBimage->width, RGBimage->height, RGBimage->widthStep, QImage::Format_RGB888);
cvReleaseImage(&BGRimage);
cvReleaseImage(&RGBimage);
本文来源:http://ebkk.blog.163.com/blog/static/1941350852010019102715985/