C++ opencv Mat to QPixmap errors
问题 I am attempting to write a function which puts a greyscale OpenCv Mat into a Qt QPixmap, then into a QLabel. A third of the time it works. A third of the time, it skews the image... becomes The rest of the time, the program crashes, specifically on the fromImage() line. I know that the incoming Mat objects are greyscale and non-null in each case. Here is the code in question... void MainWindow::updateCanvasLabel(Mat mat){ imwrite("c:/pics/last-opened.jpg", mat); //to verify that Mat is //