1 | initial version |
There is several stanges/issues/bugs in your code:
Why when you create QImage you pass 4-th argument as Mat.step()? To create QImage you should provide the number of bytes per line. So the calls should be:
QImage qoriginal((const uchar*)original.data,original.cols,original.rows,original.cols*3,QImage::Format_RGB888);
QImage qgray((const uchar*)gray.data,gray.cols,gray.rows,gray.cols,QImage::Format_Grayscale8);
Qimage could be created from the raw data only if raw data is continuous, so you need to check:
if(original.isContinuous() && gray.isContinuous()) {
// create QImages
}
Update your opencv version to the last one
Use QPainter to draw QImage on the QWidget instead of QLabel with QPixmap, research of how to here