PDA

View Full Version : How to mirror the image in QCameraViewFinder?



Violet Giraffe
1st April 2016, 20:05
I have a very simple desktop application that streams image from a camera to a widget using QCamera + QCameraViewfinder. Not I need to mirror the image from the camera, and I can find no way of doing it. Any ideas are welcome.

d_stranz
2nd April 2016, 17:47
Do you get a QImage during this process? You can apply a QTransform to it that; QImage has in fact a QImage::mirrored() method to do exactly that.

I would look at the source code for QVideoWidget::paintEvent() to see what happens there. You may be able to derive a widget from QCameraViewFinder and rewrite the paintEvent() code to get the image and mirror it before passing it to the base class for painting.

Violet Giraffe
2nd April 2016, 17:54
Do you get a QImage during this process?
No. Clearly, if I did, this wouldn't be a problem.

From experience, hacking into the Qt algorithms the way you suggested is usually impossible because you'd need to include private Qt bits into your project. Which you can't do.

d_stranz
3rd April 2016, 00:00
After I replied, I did look into the source, and as you say, it is never as simple as you would hope it would be. The private bits often do prevent you from doing what should be easy.