Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Device busy while capturing still image from a live webcam
Forum Updated to NodeBB v4.3 + New Features

Device busy while capturing still image from a live webcam

Scheduled Pinned Locked Moved General and Desktop
cameracaptureimageqt 5.4.1
6 Posts 3 Posters 4.7k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GenisiusH
    wrote on last edited by GenisiusH
    #1

    Hello everyone,

    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.

    Best Regards,
    Genisius Hartanto

    1 Reply Last reply
    0
    • SurajS Offline
      SurajS Offline
      Suraj
      wrote on last edited by
      #2

      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...

      1 Reply Last reply
      0
      • SurajS Offline
        SurajS Offline
        Suraj
        wrote on last edited by Suraj
        #3

        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.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          LuGRU
          wrote on last edited by
          #4

          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:
          http://doc.qt.io/qt-5/qtmultimediawidgets-camera-example.html
          http://doc.qt.io/qt-5/qtwidgets-desktop-screenshot-example.html

          1 Reply Last reply
          0
          • G Offline
            G Offline
            GenisiusH
            wrote on last edited by
            #5

            @Suraj @LuGRU
            Thanks for your replies.
            I solved my problem just by simply stopping the timer, update the image to another label, and then restart the timer after saving the image to a file.

            For @Suraj, have you solved your problem? Sorry for just replying the post.

            1 Reply Last reply
            0
            • SurajS Offline
              SurajS Offline
              Suraj
              wrote on last edited by
              #6

              @LuGRU
              Thank sir for your replay.. yes i solve my problem.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved