Device busy while capturing still image from a live webcam
I am trying to make a program to show live output of a webcam and also a simple button to capture the still image, using Qt and OpenCV.
i tried using fswebcam and another terminal-based image capture, but it does not seem to be working. It shows the output: "Device is busy", sort of that. I started to think that i cannot capture the still image from a live webcam, since it cannot be used at the same time.
Is there any idea about this? Can I capture still image while showing the live output in the same GUI? If yes, what's the command in Qt? I use Ubuntu 14.04 and Qt version 5.
Sir, i am new to QT. So help me to fix this as i want to do the samething like you. I want to show live streming through webcamera...as i am using QTCreater 3.2.2 and QT 4.8 on fedora 20.
sir, i have done recording video and capturing video by using following code. I just call this code by using slots of "capture image" and "record a video":
// For Video:-
system("ffmpeg -f video4linux2 -i /dev/video0 -vcodec mpeg4 -b 12000k -r 25 -t 00:00:55 test12.avi");
//For image capture:-
system("fswebcam -s 15 --jpeg 95 --save /abasfc.jpeg");
Sir, i just want view this particular item on GUI (On QLabel or something) at the time of capturing image and recording video.. How to do that?
thanks in advance...
As you are already start the webcamera through GUI...It is configure with it...and on button you are giving konsole command...This command checks for availability of device and it found out that camera is already aquired by that particular gui element. so...It is showing this error.
Basic approach here would be to "plug in" Your image capture code between image acquisition code and frame display code.
This can be done in various ways depending on library / framework that is used.
Please keep in mind that Qt offers class to access web cams QCamera / Camera.
Also libVLC and FFmpeg (c/c++ interfaces) correctly set up will allow to access directly image bits thus giving much more options if it comes to presentation, i.e. frame can be displayed using shaders / ogl / Qt paintings etc.
Another approach is to take "screen shoot" of widget showing web cam frame.
QCamera and ScreenShoot are in Qt examples:
For @Suraj, have you solved your problem? Sorry for just replying the post.
Thank sir for your replay.. yes i solve my problem.