# OpenCV Library

**URL:** https://forums.openmv.io/t/opencv-library/668
**Category:** OpenMV Boards
**Created:** [April 27, 2018, 8:59pm UTC](https://forums.openmv.io/t/opencv-library/668 "2018-04-27T20:59:47Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![lab](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@lab](https://forums.openmv.io/u/lab)
#### Post date: [April 27, 2018, 8:59pm UTC](https://forums.openmv.io/t/opencv-library/668/1 "2018-04-27T20:59:47Z")

</div>

Is it possible to import the cv2 Python extension from OpenCV so that we can access the library in OpenMV? For instance, we would like to implement the cv2.HoughCircles function to do circle detection.

Or is it possible to convert the OpenCV source code from C++ to Python?

---

<div class="post-metadata">

### Author: ![iScienceLuvr](https://avatars.discourse-cdn.com/v4/letter/i/87869e/32.png) [@iScienceLuvr](https://forums.openmv.io/u/iScienceLuvr)
#### Post date: [April 28, 2018, 8:30am UTC](https://forums.openmv.io/t/opencv-library/668/2 "2018-04-28T08:30:10Z")

</div>

Yes, I am also interested in this functionality. I want to use lucas-kanade algorithm in OpenCV on the OpenMV camera.

---

<div class="post-metadata">

### Author: ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)
#### Post date: [April 28, 2018, 4:56pm UTC](https://forums.openmv.io/t/opencv-library/668/3 "2018-04-28T16:56:25Z")

</div>

Hi, we already have circle detection on the OpenMV Cam. There’s a method called find\_circles(). It implements circle detection using the Hough Transform.

As for optical flow… we have that using phase correlation which is better than the lucas-kanade algorithm. There are examples for these things in the IDE examples folder.

---

<div class="post-metadata">

### Author: ![iScienceLuvr](https://avatars.discourse-cdn.com/v4/letter/i/87869e/32.png) [@iScienceLuvr](https://forums.openmv.io/u/iScienceLuvr)
#### Post date: [April 28, 2018, 8:19pm UTC](https://forums.openmv.io/t/opencv-library/668/4 "2018-04-28T20:19:24Z")

</div>

But there is no way for using OpenCV with OpenMV? I am interested in using some other OpenCV functions (like estimating geometric transforms) as well…

---

<div class="post-metadata">

### Author: ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)
#### Post date: [April 28, 2018, 9:13pm UTC](https://forums.openmv.io/t/opencv-library/668/5 "2018-04-28T21:13:47Z")

</div>

Please see the rotation correction method. It can do perspective transformation in the x/y/z direction.

As for a more general approach. I plan to add the ability for it to take a list of 4 points and it will do a homography transform.

…

But, anyway, no, all the vision stuff is running on a microcontroller with has a very limited amount of heap space. When me and Ibrahim started working on this project we were developing with the M4 processor which was very limited. Only on the M7 has it been possible to run desktop libraries like AprilTags/Libdmtx/ZBar etc. Even then, to use these libraries we had to port the code by redoing memory allocations. We’ve been feature creeping with the platform to make it more useful… but, in general the design goal was to just make a sure easy to get started color tracking system like a Pixy Cam but more flexible and able to do everything itself.

Anyway, it’s quite possible to run desktop code on the camera if you use the C programming interface: [Home · openmv/openmv Wiki · GitHub](https://github.com/openmv/openmv/wiki). You can really extend the system to do what you want. Note that the AprilTag code brings in a full matrix library with SVD support: [https://github.com/openmv/openmv/blob/master/src/omv/img/apriltag.c#L1027](https://github.com/openmv/openmv/blob/master/src/omv/img/apriltag.c#L1027)

---

<div class="post-metadata">

### Author: ![lab](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@lab](https://forums.openmv.io/u/lab)
#### Post date: [May 19, 2018, 11:23pm UTC](https://forums.openmv.io/t/opencv-library/668/6 "2018-05-19T23:23:28Z")

</div>

Do you have plans to implement contrast and brightness correction functions (α, β, G) in openMV?

[https://docs.opencv.org/3.4.1/d3/dc1/tutorial\_basic\_linear\_transform.html](https://docs.opencv.org/3.4.1/d3/dc1/tutorial_basic_linear_transform.html)

> **[OpenCV Gamma Correction - PyImageSearch](https://pyimagesearch.com/2015/10/05/opencv-gamma-correction/)**
>
> In this tutorial I'll show you how to implement a super fast, easy to use Gamma correction function using Python and OpenCV. Click here to learn more.

---

<div class="post-metadata">

### Author: ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)
#### Post date: [May 22, 2018, 3:56am UTC](https://forums.openmv.io/t/opencv-library/668/7 "2018-05-22T03:56:38Z")

</div>

Brightness correction is available already by using morph() [image — machine vision — MicroPython 1.15 documentation](http://docs.openmv.io/library/omv.image.html?highlight=morph#image.image.morph)

Um, but, yes, I can add a method for brightness, contrast, and gamma correction. What would you like? Like, what kind of API for it?
