Results 1 to 5 of 5

Thread: Capturing the raw image from webcam and display it on QWidget

  1. #1
    Join Date
    Apr 2011
    Posts
    39
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Capturing the raw image from webcam and display it on QWidget

    Hi,

    I am capturing the raw image and forming the QImage and then using the QImage to QPixmap conversion I am displaying it on QLabel.

    Now the problem is that my CPU usage is 70-75 %.

    and I want to reduce that
    so Please suggest me the solution,
    or the defect where my program is consuming more memory.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Capturing the raw image from webcam and display it on QWidget

    Probably you are capturing the images in some kind of while(1) loop, right ?
    Here I have posted an example of capturing, processing and converting raw image data to QImage, QImage to QPixmap and displaying it in QLabel. Conversion of raw data to QImage is done pixel-by-pixel, surely its not optimal. Without image processing CPU usage in task manager is ~19-23%, and ~50% with image processing step.
    Post the code, without it we can only guess. Am I right with while(1) ?

  3. #3
    Join Date
    Apr 2011
    Posts
    39
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Capturing the raw image from webcam and display it on QWidget

    Thanks for reply,

    But that my code is also taking the same CPU usage with image processing but that is too high,
    so I want to reduce that ....
    and I am capturing the image using separate thread ....

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Capturing the raw image from webcam and display it on QWidget

    But that my code is also taking the same CPU usage with image processing but that is too high
    Why is that too high ? Are users complaining ? System hangs ?
    If you want your program to do something more than displaying still ui, you wont escape some CPU load.
    and I am capturing the image using separate thread ....
    Ok, can you show the capture code ?

  5. #5
    Join Date
    Apr 2011
    Posts
    39
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Capturing the raw image from webcam and display it on QWidget

    Actually I am capturing Image from webcam at 2048x1536 resolution and processing rotation and zooming on it.

    but I anyhow want to reduce the CPU usage that my application is using.

    any other way is also invited ....
    Attached Files Attached Files

Similar Threads

  1. Display an image to a plain QWidget
    By franco.amato in forum Qt Programming
    Replies: 4
    Last Post: 19th March 2012, 10:07
  2. Replies: 8
    Last Post: 18th March 2011, 12:27
  3. Current webcam image behind an OpenGL Scene
    By vrcat in forum Qt Programming
    Replies: 0
    Last Post: 4th June 2009, 15:26
  4. synchronise QLabel display and webcam capture
    By fbmfbm in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2009, 12:10
  5. ¿How to stop thread that is capturing from a webcam?
    By JoseTlaseca in forum Qt Programming
    Replies: 8
    Last Post: 28th August 2008, 05:45

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.