最近出现: 错误:‘Format_RGB32’不是‘QImage’的成员,代码具体完整代码如下,谢谢指导解决
#include <qt.h>
#include <cv.h>
#include <highgui.h>
#include <qimage.h>
QImage & cvxCopyIplImage(const IplImage *pIplImage, QImage &qImage)
{
if(!pIplImage) return qImage;
// 调整qImage的大小
if(qImage.isNull())
{
int w = pIplImage->width;
int h = pIplImage->height;
qImage = QImage(w, h, QImage::Format_RGB32);
}
// 复制像素
int x, y;
for(x = 0; x < pIplImage->width; ++x)
{
for(y = 0; y < pIplImage->height; ++y)
{
CvScalar color = cvGet2D(pIplImage, y, x);
int r = color.val[2];
int g = color.val[1];
int b = color.val[0];
qImage.setPixel(x, y, qRgb(r,g,b));
}
}
return qImage;
}