Computer Vision-OpenCV

I would like to use OpenCV for Open Soccer League but I do not know anything about it. It seems like I would need a fast processor and to code in OpenCV’s C++ version. Does anyone have any recommendations as to where I should start to learn OpenCV? Thank you!

Ohh, OpenCV is nice! :smiley:

For a RoboCup Junior robot I would recommend using the Raspberry PI, Banana PI, Beaglebone or similar one-chip computer. You can use the C++ or the Python API for OpenCV. The Python version may be easier to use, but are missing some functions like GPU processing, but on a Raspberry you don’t have access to a dedicated GPU.

Some people may say that the python version is slower, but the underlying image processing code is done in fast C++. It is however slightly slower.
My recommendation would be to pick the language you are most comfortable with and try it out in a raspberry (or similar)!

Maybe https://www.learnopencv.com/embedded-computer-vision-which-device-should-you-choose/ can be a starting point? It is a good site all in all, check it out!

// Fredrik Löfgren

1 Like

If we use Python, is there any way to port it to C++ for a Raspberry Pi, for instance? And any recommendation as to which version of Python for OpenCV purposes? Our team knows only Java and C++, but are happy to learn Python. We like the idea of Python because we want to learn it and so far haven’t loved the online support for the C++ version of OpenCV 3.2.

The Python and C++ APIs are almost identical (in functionality) and can be ported from and to each other.

You can use either Python 2 or 3. See http://www.pyimagesearch.com/2015/07/27/installing-opencv-3-0-for-both-python-2-7-and-python-3-on-your-raspberry-pi-2/ for more information.

If you already know C++, why not use it? No need to learn a new language for OpenCV.

// Fredrik Löfgren

Good question TechnoX as to why we would switch to Python. We haven’t really loved the support and tutorials that we have found for OpenCV. I think the main reason may be that everyone is in the midst of switching from 2.4 to 3.2. Many of the tutorials were written for 2.4 but it seems as though everyone is migrating quickly to 3.2 and sometimes resources don’t even specify which version a program is written for. If there were a site like pyimagesearch for OpenCV 2.4 or 3.2, that would be great. Do you know of one? Thanks!

Hi @BenditLikeBeckOhm,

Sorry to hijack the discussion – I would like to add a point or two.

My personal advice would be as follows: try to stick with OpenCV 2.4 as much as you can. Most of the material you’ll find online will target this version.

I do agree that good quality introductory materials on OpenCV (and associated methods and techniques) are quite hard to find. As far as I know, pyimagesearch seems to be the best one can find.

If you run into a specific issue that you cannot seem to find an answer to online, feel free to ask here. Someone may be able to help you and other can benefit from the discussion too!

1 Like

To share some material that I , along with much assistance from our center’s technology chief advisor, wrote up something quick for my students past 2017 summer (please excuse some typos) :

I hope you will find them useful. The docs listed above were written for my 8 students who have good level of algorithmic programming skill in C learning python in order to play with Opencv. In 3 days of 5 hours workshop, they managed to learn python, basic image processing using OpenCV. They managed to completed the following exercises:

  • tally coins
  • recognize colored objects
  • play a simple orange ball chasing game.

About online learning materials:
There are very rich online learning materials, which are often referenced in the documents I mentioned earlier.

One comment about doing image processing with plain C/C++ instead of Python: If you already have good understanding in data structure including memory pointers, function pointers, etc., learning from the online opencv document will be far much easier. If not, it will be far better to stick with Python. Besides, in opencv, much is about the numpy and using tuples. So, if your students will learn python, they need to put much focuses on tuples data structure.

Why bother with python if you know C/C++ already?
Well, if your intent is to do lot more with raspberry pi, learning python will be helpful as I have noticed the devices which work on PI usually provide only python library. Well, if students already have good programming skill, and understanding in data structure, building library of functions, understanding portability, etc. , they can also port their python library over, BUT that can be quite time consuming. It is a great learning experience in itself. After that, they will feel like a mini-professional :slight_smile: .

Now, I found that you could embed python with C++ projects, and vice versa too. This can be an avenue your student may want to explore.