What makes the OpenCV so common in machine vision? – Into Robotics

 

With an estimated number of downloads that exceed 9 million, the OpenCV is adopted all around the world and has become the rebel teenager in computer vision.

OpenCV is a collection of more than 2500 optimized algorithms focused on real-time processing which combine patent-free implementations of the latest computer vision algorithms.

But above all things, OpenCV is free for commercial or research use. Most probably, this is the most important feature for a maker, student, etc.

To learn more about computer vision, one of the best ways is to start building computer vision applications as soon as possible. In this article, I’ll cover 10 things that will help you to understand why the OpenCV library is so common in machine vision.

In which field do you use OpenCV?

The versatility of human vision was not beaten by any machine so far, but their limits in manufacturing environment increase the necessary to create artificial systems and increase the productivity.

The OpenCV is a multipurpose computer vision library with abilities to process, analyze and understand images the same way the human eyes does.

With thousands of optimized algorithms, the OpenCV provides the toolkit for various computer vision applications in research, robotics, DIY, multimedia, medical, automotive, etc.

According to the about page of the library, even the Google Street View application uses the OpenCV to running interactive art shows.

OpenCV and a variety of applications

The recognition of a face is an easy task for humans, so simple that most often we are not aware of it. Even a three-day-old baby can differentiate between known faces. But how hard could it be for a computer to detect and recognize a face?

The OpenCV library is released under a free licence and it’s the reference of what means the computer vision. This open-source library of algorithms is the main core of machine vision for what means the object detection, motion detection, resize and crop an image, augmented reality, biometric security, etc.

In the DIY culture, the OpenCV is used in applications such as face detection and recognition, line detection, image comparison, fingerprint recognition, video streaming, text extraction, 2D to 3D modeling, and many other applications.

Operating system compatibility

The operating system compatibility is still one of the top priority issues when it comes to machine vision. The OpenCV library usually guarantees a high degree of portability and includes in its specifications a long list of compatible operating systems.

Linux seems the most attractive platform for developers, but not all designers share this enthusiasm. No more than 65% of OpenCV developers use the library on Windows systems, and from the same number of developers, 60% of them run at least one time the library on Linux OS.

For mobile application, the Android is the attractive platform because the machine vision applications can run across hundred of devices with different combinations of features such as screen size, aspect ratio or pixel density.

If you want to run the OpenCV, you need to know that the library runs on Windows, Linux, OS X, Android, OS, Maemo, FreeBSD, OpenBSD, and BlackBerry 10.

Provide support for high-level programming language

The OpenCV algorithms are all implemented in C, which is easy to understand why. Even if the library has its base in the C++ language, all the OpenCV algorithms can be used with a large variety of languages like Java, Python, etc. The bridge between the C++ and any other language like Java is possible due to a series of bindings generators. These generators give you the access to C++ functions from any other programming language.

Depending on your programming skills, you can choose any programming language from the above list to build your computer vision application with OpenCV. As can be seen, 86% of the makers use the library with C++ and 32% of makers try at least once the Python.

The C and C++ languages are fast and powerful for image processing and analysis. Another advantage of these languages is that you can access directly the memory and process the value compared with other languages that need more time to obtain the value from the memory and process.

If you need simplicity, you can focus on Python. This language is slower compared with C and C++, but the language is simple and portable.

The OpenCV and embedded platforms

The OpenCV and its compatibility with embedded platforms are like the living species that depends on the mutation and adapt to survive.

Since from the first version, the OpenCV design ensures the portability and compatibility with any system that provides a C/C++ compiler. Over time, the OpenCV was successfully ported to ARM, PowerPC, MIPS, Blackfin, and Xscale platforms.

So you can run the library on a large variety of embedded platforms with video input and one compatible operating system. Of course, there are performance constraints because not every single board computer or mobile platform can run OpenCV applications for a long time at full speed.

If you’re a maker with a Raspberry Pi, BeagleBone or a PandaBoard in your garage, you’re lucky because all of these single board computers can run in real-time OpenCV applications. As for mobile platforms, the library runs on Windows, Android and iOS operating systems and smartphones such as iPhone, Samsung or Nokia.

The approach

Being a little bit different probably won’t hurt when you’re working on computer vision applications. More than that, doing something different, you have all the changes to become the genius behind the OpenCV.

Every OpenCV application puts the imagination of the developer at work. You can implement an idea with a simple and dumb solution, or you have to drink a ton of coffee and ruin your holiday to develop the simplest computer vision application. This is the delight of the OpenCV library.
The biggest challenge is to choose the optimal algorithm and perform the right steps to build what is necessary for a vision system able to capture the surrounded environment and its details.

Image processing

To search for a delicate or an ugly face within pictures, the OpenCV library uses a variety of machine learning algorithms. Just one simple test cannot tell you if in the picture is the right face or not. For something as complicated as a human face, the algorithm search over thousands of features and patterns that should match with what you find.

The big job of search is now divided into thousands of smaller tasks that can be easily solved. All these tiny tasks are called classifiers.

Only for a face, the computer should run at least 6,000 of classifiers, which is a hard job even for a web of transistors. Even so, the search problem doesn’t end here.

When the picture enters in the clutches of the algorithm, it starts to search for a face at the top left of the picture and move down on each block of data. The algorithm has the job to ask constantly, “Is this a face?” for every block on the map.

With some math in the head, the computer should do at least 6,000 tests for each block, which means millions of calculations for the entire picture. All these calculations will erase any performance of any decent computer.
So, we have to move next, and we’re moving with the algorithm down into a cascade. This is not a real water cascade, but it works on the same principle. The algorithm does a very rough and quick test for each block of a picture. If all the tests passed the stages, the algorithm enters something deeper into the problem and detects the face.

This detection method has the advantage that almost all the pictures processed return negative tests during the first few stages, which means that the algorithm will jump the tests of all 6,000 features of every stage. In other words, instead detecting a face in hours, the same face is detected in real time.

Above I explained the detection process because the face detection is a common application for the OpenCV library. The same cascade process is applied to hands, legs or eyes. But if you want to detect common objects such as an apple, the algorithm has built-in algorithms for that.

Video processing

Processing video is almost the same as image processing. The biggest difference is that the process has an optimal structure in order to maintain the same speed for the video stream. If searching a face in a picture the processor deals with only one picture, in video processing the same processor has to deal with thousands of images in a row.

The speed aspect of OpenCV

A machine vision system combines computer hardware and software with digital input/output devices such as cameras and computer networks to store and share the image data.

It doesn’t even seem important at the first glance, but the speed is an essential deal for all developers. In the OpenCV survey, more than half of developers thinks that the speed of the OpenCV is good, and only three percent concluded that the library is slow.

And because the community needs speed, the OpenCV developers are always focused to develop a library faster than its predecessor.

Common tools

I cannot suggest any digital camera for machine vision with OpenCV because a large variety of cameras can be used to capture pictures or videos. You’re relatively free to choose any camera featured with a sensor enough to capture vivid images. The simplest solution for a machine vision system is to connect the camera directly to a computer and start to discover the algorithm and its characteristics.

If you choose a webcam, you’ll probably look like an amateur. But even so, there are several cameras that can transform a simple vision system into an eagle that pursues its prey. Of course, we cannot compare the webcams with the vision systems used in industrial applications and with great results on any production line. But an HD camera, stereo camera, the Kinect sensor, or the Raspberry Pi camera is sufficient for any maker to try a vision application.

The community

With an estimated number of 9 million downloads and more than 47 thousand people of the user community, the OpenCV is a hot topic all around the world. But even with a great community of makers, the computer vision isn’t exactly a simple problem.

Thousands of tutorials, examples and projects cannot replace the lack of documentation. This aspect was reviewed in the survey numbers were only 29% of the users think that the documentation is good, 22% bad while 44% believe that this should have to be improved.

OpenCV SurveyOpenCV remains the most useful machine vision library. Any of its alternatives cannot count the same number of community members, projects, and resources of this open-source computer vision library.

 

 

 

Share:

Related Posts

Don't Miss Out!

Get the latest news, tutorials, reviews and more direct to your inbox when you subscribe!