Ask Your Question

OpenCV integrate in MCU

asked 2016-12-20 23:41:36 -0600

SaurabhPatel gravatar image

Hello All, I am embedded guy and have only experience in MCU (Not Linux based system). I am looking for the solution to port OpenCV in MCU (Minimum Sub-system, e.g. STM32F4). Please let me know what minimum resources like processing power (MHz), RAM, Single precision FP require to run OpenCV for MCU for finger detection?

Is this possible or only require Linux to run OpenCV?


edit retag flag offensive close merge delete


that's a microcontroller, not a computer ?

berak gravatar imageberak ( 2016-12-20 23:46:04 -0600 )edit

Yes, I want solution for Micro controller only if possible

SaurabhPatel gravatar imageSaurabhPatel ( 2016-12-21 01:54:13 -0600 )edit

not an expert, but your chances seem low. (even a simple malloc() requires an os of some kind)

berak gravatar imageberak ( 2016-12-21 02:02:22 -0600 )edit

Hey Berak!! Thanks for your opinion... May i have minimum resources details if you have worked on OpenCV? After lot of googling, i came to certain things like require high processing capable CPU, huge RAM, multiple FPs, but don't find exact minimum number of that resources..It would be helpful for me if i have that numbers.

I just want to know the exact reasons why OpenCV is not possible to port in MCU?

SaurabhPatel gravatar imageSaurabhPatel ( 2016-12-21 02:25:19 -0600 )edit

again, i cannot answer your question, but maybe have a look here .

berak gravatar imageberak ( 2016-12-21 02:31:30 -0600 )edit

I have no experience with microcontrollers but in my opinion it depends also of the type of architecture of the microcontroller (with ARM microcontrollers, maybe it is feasible). If the task is really specific (finger detection), I would implement myself the few necessary functions (color space conversion, image thresholding, contour detection, etc.) instead of trying to compile / port OpenCV on another architecture.

Eduardo gravatar imageEduardo ( 2016-12-21 07:04:53 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-12-21 08:32:34 -0600

kbarni gravatar image

updated 2019-02-20 05:03:48 -0600

OpenCV isn't portable to microcontroller systems. Current MCUs have similar architecture and computing power as ARM CPUs, but as long as your system can't handle the minimum software requirements, it won't work.

However OpenVx might be the thing you are looking for. It is a computer vision library for embedded devices. Several vision-oriented microcontrollers are compatible with OpenVx. (I don't know the STM32F4, but STMicroelectronics makes OpenVX compatible MCUs).

Otherwise you'll have to implement the algorithms yourself, as @Eduardo said. Writing a specific application for a target architecture will be much-much more efficient than using 3rd party libraries.

[UPDATE] There is also a Python library adapted to MCUs called MicroPython. This can simplify the memory management and array operations compared to C++. MicroPython can even have image processing libraries for certain boards e.g. OpenMV.

edit flag offensive delete link more


Thanks @kbarni and @Eduardo!! I am pretty clear from your comment that OpenCV porting is not work with MCU as MCU comes with limited processing capacity and limited RAM.

@Eduardo - Thanks for pointing openVx. I'll dig more on it at my end. However, it would be great if you share here some details on OpenVx like where you got the details that it is possible with STMicroelectronics. Actually, I am looking for 'finger detection' solution is feasible using IR camera with ST MCU.I am allow to use any open lib for image processing.

SaurabhPatel gravatar imageSaurabhPatel ( 2016-12-21 23:20:03 -0600 )edit

OpenVx is developed by the Khronos Group, I suggest you to take a look into their "specification PDF" since is very detailed and probably contain the answer to your question. Unfortunately I don't use it, I just know that exist so I can't be that helpful. A good start can be implement your algorithm in OpenCV and then port the code according to the OpenVx API or as @Eduardo says, write it down from scratch. The latter, in my honest opinion, it is probably the best idea since you can have better performance and power consumption, without create useless overhead. One of the biggest problem maybe it will be the memory management, so use such library as MicroPython to overcome this problem can be a good idea, as @kbarni suggested, but be aware regarding the used resources by this library.

HYPEREGO gravatar imageHYPEREGO ( 2019-02-21 09:19:17 -0600 )edit

Question Tools

1 follower


Asked: 2016-12-20 23:41:36 -0600

Seen: 4,478 times

Last updated: Feb 20 '19