Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Convert an image cv::Mat to QImage
isaacEnrique last edited by
I'm working on a project with Qt + OpenCV and I need to convert an image cv::Mat to QImage and / or viceversa. Does anyone know how to do?
Thanks in advance for any answers or comments.
If you are using one of the types supported by QImage, you can use the constructor taking an (const) uchar * input.
And the same in reverse, get the data from QImage with the bits function.
As the doc state, look carefully for the lifetime of your data.
http://qt-project.org/doc/qt-4.8/qimage.html#QImage-4 and its friends