QImage 与 Mat

 Mat 转换为QImage

Mat 里面到BGR顺序,首先要转换成RGB格式

QImage::QImage ( uchar * data, int width, int height, int bytesPerLine, Format format )

	Mat img;
	QImage *qimg;
	img = imread("../image/aa.jpg");
	cvtColor(img, img, CV_BGR2RGB);
	qimg = new QImage((unsigned char*)img.data, // uchar* data
			img.cols, img.rows, // width height
			img.step, //bytesPerLine
			QImage::Format_RGB888); //format


你可能感兴趣的:(QImage 与 Mat)