PDA

View Full Version : Grab a frame from video when a push button is pressed!!!



Jakr1387
28th August 2014, 13:55
Hi Everyone,

I am creating a gui in Qt with openCV library. The thing is I can able to display a video in QLabel when a push button is pressed, but now I have to grab a frame from it when another pushButton is pressed and need to display it in another QLabel. How can I do It? Can someone help me out?

Thanks in Advance!!!

jakr1387

anda_skoa
28th August 2014, 14:31
Just take the pixmap from the first label and also set it on the second.

Cheers,
_

Jakr1387
28th August 2014, 14:45
Thanks anda_skoa!!!

Just now saw your post and I did exactly what you said and made it working. I have another question if you dont mind. I have a video running in my first QLabel, I need to freeze it when i push some other button.

anda_skoa
28th August 2014, 15:23
Depending on what kind of UI you want, you could use a QPushButton with setCheckable(true) and then check its "checked" state in the function that gets frames.
Or use a normal push button and set a flag variable and check against that.

Cheers,
_

Jakr1387
2nd September 2014, 14:55
Hi everyone!!!

I have a small issue in displaying a new image in Qlabel. I have a video running in Qlabel when a pushbutton is pressed, and I am grabing a frame from the video and updating the same Qlabel when another pushbutton is pressed. My problem here is when I push the second pushbutton, Qlabel is loaded with old frame, but when I push the second push button again, I am getting my frame in Qlabel.


Can someone suggest me what is an issue?


Thanks in advance!!!

jakr1387

wysota
2nd September 2014, 15:00
The issue is you are setting an incorrect pixmap on the label.

Jakr1387
3rd September 2014, 05:44
Hi wysota,

I could not find anything. I am pointing to the correct label, maybe I have something missing. Plz find the attached code


thanks in advance!!
jakr1387

wysota
3rd September 2014, 07:06
What does cap.read() return? What does cap.retrieve() return?