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

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".

Related

ROS node for compressed video with a very low latency for raspberry camera module V2

Im using raspberry Pi 4 B and have installed ROS melodic. I have Raspberry Pi Camera V2.1. Would like to send a compressed video with a low latency as much as possible to the Microrcontroller (ESP32) via sonar. So its important to have a very low latency as the sonar has a low bandwidth. I look at this github camera node raspberry pi camera node for Pi Camera V2 but the compressed video has a latency of more than 2 seconds. Any other way or other approaches or other help to overcome the issue with the latency?
Thanks
High latency won't necessarily affect a system with low bandwidth so long as the transmission is consistent. With any camera being processed through ROS there will almost always be some delay. The above node will probably be one of your best bets, however, there is the usb cam node. If neither of these are sufficient you'll probably need to sit down and crunch the numbers to make sure you actually have enough bandwidth/processing power. Then you might want to look into creating your own video streaming node that's a little more tailor made and lower overhead; I'd suggest gstreamer for this.

Showing image OpenCV in Raspberry Pi 4 is slow

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

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.

usb webcam runs slowly on raspberry pi with opencv

I have some code that I have adapted to run on a headless Rpi using a usb webcam, it is running a bit slow, so my questions are:
If I were to use the GPI pins with a dedicated webcam would that be faster?
Is there any way to speed up my code for Rpi?
Where can I get a Rpi webcam?
My code is here, I struggle to paste inline so its a link
For your question about where to get a Pi camera, a new camera has recently been release. I don't know about speeding up you code, but you might want to overclock your Pi. Good luck,
Like Quentin suggested, a dedicated Camera (in our case, Rpi camera link : http://www.raspberrypi.org/camera) should work much faster than USB webcams as it is known to use GPU for encoding / decoding process instead of using CPU.
(Source : http://www.raspberrypi.org/phpBB3/viewtopic.php?t=55798)
You can try reducing width and height of the frame for better performance in terms of speed.
Also you're using Iplimage* which is no longer supported in new OpenCV versions and replaced by cvMat.
(source: Difference between cvMat, Mat and IpImage)
Hope it helps.

Resources