失真前
失真处理后
废话不多说,上代码:void CenterWindow::displayResult(Mat mat)
{ //show the resultImage in result area;
Mat rgb;
QImage img;
if(mat.channels() == 3) // RGB image
{
cvtColor(mat,rgb,CV_BGR2RGB);
img = QImage((const uchar*)(rgb.data), //(const unsigned char*)
rgb.cols,rgb.rows,
rgb.cols*rgb.channels(), //new add
QImage::Format_RGB888);
}else // gray image
{
img = QImage((const uchar*)(mat.data),
mat.cols,mat.rows,
mat.cols*mat.channels(), //new add
QImage::Format_Indexed8);
}
resultImageLabel->setPixmap(QPixmap::fromImage(img));
resultImageLabel->resize(resultImageLabel->pixmap()->size());
resultImageLabel->show();
}