Page 1 of 1

Pi Camera vs USB WebCam for OpenCV

Posted: Mon Aug 27, 2018 2:29 pm
by ChicagoBob123
If I was using a raspberry Pi 3B+
What is the BEST overall performance option for using OpenCV to analyze video. I did a lot of searches and the information is NOT current and bit vague. Open CV works with uncompressed data or bytes. The most technical piece I found was dated in 2015.
"The PiCamera 'run' by the GPU and can dump full frames into RAM at 15 frames a second, while the data from the USB goes straight into ram."

So if I wanted maximum performance for manipulating video frames with OpenCV at resolutions at or above 640x480 I would choose the USB WebCam since the data needs to be uncompressed and in regular memory? Or is this different now since the Pi 3 is multi core and faster?

Can anyone please offer me a more definitive answer.

Re: Pi Camera vs USB WebCam for OpenCV

Posted: Thu Aug 30, 2018 2:31 pm
by ChicagoBob123
I am hoping more information will get me an answer. The question is
using a Raspberry Pi B+ does OpenCV work faster using a USB camera or
with the Pi Camera at resolutions of 640x480 and above.
OpenCV in this case is used to read and manipulate the image data then output it to the screen.
Thanks for any help.

Re: Pi Camera vs USB WebCam for OpenCV

Posted: Tue Sep 04, 2018 6:44 pm
by njsss
Pi camera has higher frame rate and resolution, but as you said the image is not raw (10bit). There's a thread dedicated to retrieve raw image with modified driver I believe. With only sub2.0, I don't see any usb wecam can compete with speed. If you only use opencv to process image/video, I don't see that matters anyhow.

Re: Pi Camera vs USB WebCam for OpenCV

Posted: Wed Sep 05, 2018 6:05 pm
by ChicagoBob123
What I don't know is if decompression of the video frame or transfer from the GPU memory to CPU memory takes longer than reading in an uncompressed RGB frame to be manipulated.

Re: Pi Camera vs USB WebCam for OpenCV

Posted: Wed Sep 05, 2018 7:06 pm
by HermannSW
I cannot help on USB, but say that I was negatively impressed on OpenCV performance. Edge detection on small 320x208 frames took 20ms(!), not allowing for high framerate video processing:
https://www.raspberrypi.org/forums/view ... 8#p1250429

The robot target speed is 5m/s, and getting frame analyzed after >20ms is not acceptable, in that time the robot has moved 10cm ...

Re: Pi Camera vs USB WebCam for OpenCV

Posted: Wed Sep 05, 2018 7:19 pm
by ChicagoBob123
So what do you use to speed up image filtering, like a haarcascade. I agree opencv is not optimized.