PDA

View Full Version : When I take a picture with the webcam, I get the previous picture



feraudyh
7th February 2014, 19:01
Hello,
I have modified the Multimedia camera sample to take pictures in an applications, save it as a file and display the picture in a label by loading if from the file.
The strange thing is that the picture that is displayed in the label is not the picture I have just taken, but the previous capture.
This is perhaps a classic beginner's mistake, but can you give me any pointers to the litterature or advice?
i've tried to erase the previous picture before the capture but then I get a message saying the picture does not exist.

Oh and by the way QPixmap::load() has not worked with BMP files, nor PNG files, but only JPG files.

My environment is Win 7, Qt 5.2.1 with MingW.

anda_skoa
7th February 2014, 20:21
It is hard to tell without knowing any of the involved code, but


i've tried to erase the previous picture before the capture but then I get a message saying the picture does not exist.

that could suggest that your problem is the saving code. Maybe saving is done with some kind of asynchronous operation which has not finsihed when you are trying to load.



Oh and by the way QPixmap::load() has not worked with BMP files, nor PNG files, but only JPG files.


That sounds like the image format plugins for BMP and PNG not being built or not being found at runtime.

Cheers
_

feraudyh
8th February 2014, 10:00
Well it seems like it's a problem of synchonization. I am using signals and slots to save the picture. Maybe I could be saving it otherwise.

I'll look into the plugins. I see the plugins/imageformats directory and dont see anything that seems related to png.

thankyou