Showing image OpenCV in Raspberry Pi 4 is slow - opencv

Show image in Raspberry pi 4 with OpenCV takes a lot of CPU resources, is there any way to employ GPU resource to speed it up

Related

How change the memory frequency in raspberry pi 4

How to change the frequency of memory in raspberry pi 4 in a similar way to how we change the CPU frequency. so scientific articles mention that we can do that from the BIOS but i did not find any way to do that.

Is it possible to run OpenCV on Raspberry Pi Pico onboard?

I need to build standalone module which records video from rasberry pi camera to sd card (through external module) when the motion on video is detected.
So, I need to run OpenCV that I will use for motion detection. Is it possible to run it on Raspberry Pi Pico on board? How much FPS will it have in case for i.e. background subtraction?
The RPi Pico uses an RP2040.
RP2040 is a dual-core ARM Cortex-M0+. It comes with "264kB on-chip SRAM". You shouldn't expect this to have any power that's useful for image processing. It doesn't even run Linux. Were those 264 kB fully available to you, you could fit a single grayscale image of size 593x445 in there.
OpenCV can target ARM but not such tiny microcontrollers.
Here's some evaluations by OpenCV itself: https://opencv.org/arm/
You should investigate "OpenVX".

Could I use raspberry pi to use a pretrained CNN model for prediction?

Firstly, I'm going to train a CNN model on my computer (image classification program), then I'm gonna save it to be used in raspberry pi
After that, I'm gonna give the raspberry pi some images, I want it to predict the images using the trained model
Finally, according to the result (the prediction) , i want it to take an action.
So, is it possible to do that? if yes, what specifications should i keep in mind when i buy the raspberry pi ?
It's completely possible.
Hardware
Following main hardware specs need to be considered when you're deploying your model on edge devices like raspberry, banana pi, ...
Memory
Processing Speed
Memory - Random Access Memory(RAM). RAM allows you to deploy bigger models on your edge device and also in case of processing, the CPU is also most important one.
Raspberry Pi versions RAMs:
The Raspberry Pi 2 has 1 GiB of RAM.
The Raspberry Pi 3 has 1 GiB of RAM in the B and B+ models, and 512 MiB of RAM in the A+ model. The Raspberry Pi Zero and Zero W have 512 MiB of RAM.
The Raspberry Pi 4 is available with 2, 4 or 8 GiB of RAM. A 1 GiB model was originally available at launch in June 2019 but was discontinued in March 2020, and the 8 GiB model was introduced in May 2020.
Model Optimization
If you have one of the version of a Raspberry Pi so then you can't change it's capability however you can optimize your model by updating your neural network. So you need think about using efficient networks, such as EfficientNet, MobileNet, SqueezeNet, GhostNet.
For object detection purposes, I have used Raspberry Pi 2 B model with tiny Yolo with quite low FPS (frame per second).
I hope, from now you can consider according to your task which Raspberry Pi device is suitable for you.

converting from opencv to opencl for powerful usage of raspberry pi

I am working on raspberry pi in image processing project using opencv
But i found that it was inefficient with raspberry pi as it works on CPU and don't use powerful GPU and i must switch to openCL
Are there any method to convert from openCV to openCL
Or how can i able GPU for opencv ?
Or how i can i use opencv with acceptable fast response processing on raspberry pi ?
OpenCL modules are included in OpenCV. http://docs.opencv.org/modules/ocl/doc/introduction.html
use it.

OpenCV HOG Algorithm in Real Time on Raspberry Pi

I would like to know if it is possible to run the OpenCV HOG Detector using a Raspberry Pi in real time using the Raspberry Pi camera.
Unfortunately not, even overclocked to 1000MHz and with 64MB for video it's not enough.
On my old mac with a 2.1 GHz Dual Core Intel CPU and 2GB of ram I could barely get between 8-12 FPS for a 640x480 stream.
I haven't tried OpenCV 3.0 (just 2.4.8) on Raspberry PI so don't have any softcascades test results to share, but it sounds promising.
Another idea I can think of is using LBP cascades. You could start with a HAAR since there's one already for detecting bodies so it would be easy to test, but LBP should be a bit faster. Perhaps you could train a cascade that works really well for a set environment.
Also, if it helps, you can use my little OpenCV wrapper for the PiCamera for tests. It basically returns frames from the Pi Camera module as cv::Mat.
I've had openCV running on a PI, using a USB video grabber, as I am using a CCTV camera. I use Python.
It runs fine (for what I want to do), but you need to limit the resolution.
It's slower than a PC (2ghz dual core) but still works.

Resources