Fast way to show QImage
Hello everyone, I have a sequence of images that I need to show with frequency 50 fps. All images in format QImage::Format_Indexed8.
- My first approach was to convert image to pixmap (in separate thread) and than set it to QLabel(in main thread), it works but in pretty inefficient way. Image on a Qlabel was lagging.
- I also tried with QGraphicsView and QGraphicsScene. Result was almoustly the same as in first approach. Image was also lagging.
- Another approach was through QVideoFrame( example), it also works with all other images formats except QImage::Format_Indexed8, so I need to convert it to QImage::Format_RGB32 and than set to QAbstractVideoSurface that also was not so efficient.
Now I have doubts that in all approaches Qt somewhere in background convert image from QImage::Format_Indexed8 to some QImage::Format to draw it on QWidget, please correct me if I am wrong. I will be glad to any suggestions or help about this topic.
Ok, I figured it out. As I assumed, it always convert from QImage::Format_Indexed8 to some other format, cause in documentation written:
Drawing into a QImage with QImage::Format_Indexed8 is not supported.
Thus instead of using QImage::Format_Indexed8, I need to use QImage::Format_Grayscale8. So the best way to show image, it is with reiplementing QPaintevent with or without using OpenGl.