ChicagoBob123
Posts: 79
Joined: Fri Aug 30, 2013 1:48 pm

Pi Camera vs USB WebCam for OpenCV

Mon Aug 27, 2018 2:29 pm

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.

ChicagoBob123
Posts: 79
Joined: Fri Aug 30, 2013 1:48 pm

Re: Pi Camera vs USB WebCam for OpenCV

Thu Aug 30, 2018 2:31 pm

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.

njsss
Posts: 35
Joined: Fri May 20, 2016 9:36 pm

Re: Pi Camera vs USB WebCam for OpenCV

Tue Sep 04, 2018 6:44 pm

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.

ChicagoBob123
Posts: 79
Joined: Fri Aug 30, 2013 1:48 pm

Re: Pi Camera vs USB WebCam for OpenCV

Wed Sep 05, 2018 6:05 pm

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.

User avatar
HermannSW
Posts: 3765
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Pi Camera vs USB WebCam for OpenCV

Wed Sep 05, 2018 7:06 pm

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 ...
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

ChicagoBob123
Posts: 79
Joined: Fri Aug 30, 2013 1:48 pm

Re: Pi Camera vs USB WebCam for OpenCV

Wed Sep 05, 2018 7:19 pm

So what do you use to speed up image filtering, like a haarcascade. I agree opencv is not optimized.

Return to “Camera board”