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.
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) ? :)
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 ....
Re: Capturing the raw image from webcam and display it on QWidget
Quote:
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.
Quote:
and I am capturing the image using separate thread ....
Ok, can you show the capture code ?
1 Attachment(s)
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 ....