Qt World Summit: Register Today!

How can I display a Mat image returned by a function in main.cpp in MainWindow using QLabel?

  • Hi, how can I take the Mat image (OpenCV object) which is returned by a function imageCollage() in main.cpp and display it in the main window using QLabel?
    So far I managed to display a simple image by giving the image path:

                       QPixmap pm("/home/csimage/project/church.JPEG");
         Any pointers to helpful resources/tutorials would be much appreciated.

  • You need to convert the Mat to a QImage, and then create a QPixmap from the QImage.
    Have a look at this project: https://github.com/dbzhang800/QtOpenCV

Log in to reply