Page 1 of 1

Raspbian-Opencv-Picamera- slow

Posted: Sun Sep 03, 2017 2:51 am
by mebin
Hi friends,

Currently I am developing a Virtual Reality product, which takes the real time images using a picamera and do some image processing in opencv and display it on a lcd panel which is bought from alibaba. I am using raspiberrypi zero w with raspbian OS for this.

LCD display link: https://www.alibaba.com/product-detail/ ... b095nC7FqD

While running this, it is very slow
How can i increase the speed of pi?

Is there any possibilities for increasing the speed by considering the points below:

1. Run a run custom OS for this product.
2. Disable any hardware/software functions in the OS
3. Using usb camera instead of picamera
4. Changing the image processing library other than opencv.
5. Changing the raspberry pi model(A,A+, B,B+)


Please help me, I m just a beginner,
Thanks in Advance

Re: Raspbian-Opencv-Picamera- slow

Posted: Sun Sep 03, 2017 9:03 am
by rpdom
mebin wrote:
Sun Sep 03, 2017 2:51 am
1. Run a run custom OS for this product.
Raspbian is a custom OS for the Pi. It was specifically built to use the features of the CPU in the Pi A, B, A+, B+ and Zero that other Linux versions didn't support.
2. Disable any hardware/software functions in the OS
Unlikely to make any significant differences.
3. Using usb camera instead of picamera
Will slow things down, not speed them up. The Pi Camera has a high speed video bus directly into the GPU. USB will be a lot slower.
4. Changing the image processing library other than opencv.
I don't know this one. Video processing isn't really my field.
5. Changing the raspberry pi model(A,A+, B,B+)
The Zero uses the same chipset as those models and by default is actually clocked faster.
The Pi 2B and 3B have much more powerful CPUs, and four cores instead of one.

Re: Raspbian-Opencv-Picamera- slow

Posted: Sun Sep 03, 2017 9:43 am
by mebin
Thank u for your reply

Re: Raspbian-Opencv-Picamera- slow

Posted: Sun Sep 03, 2017 10:40 am
by OutoftheBOTS
I have used OpenCv a bit. It is 1 of the best computer vision libraries around and probably 1 of the fastest as it is very optimized for vector and parallel computing i.e it will make use of multi cores to process the image. So if you use a RPi3 instead of a RPi zero this will process the image at least 4 times faster, due to both the faster CPU as well as the fact the RPi3 is Quad core and Zero is single core

I did lots of playing with timing each step in my program so that I could optimize it. What I found was the slowest part of all is the I/O of moving the image from the camera to the RPi memory for processing of course the testing I did with a usb webcam was way slower than the PiCam testing, using lower res speeds this up a llot.

Second I did lots of playing with how to achieve the outcome that I wanted, there is usually many ways to skin a cat and you have to find what is the fastest. I found if you can convert the image to a binary image this made for very fast processing because each pixel only has 1 bit and grey scale has 1 byte and full colour has 3 bytes. Second U need to work what is the lowest resolution you can operate in because the lower the res then by far the less number of pixels to process or look at only process a ROI (region of interest) instead of processing the whole image.