An introduction to OpenCV

Catherine Huang
Aug 30, 2018 · 3 min read

After learning more about supervised Machine Learning algorithm, I briefly thought that I would be able to use OpenCV to analyze all the images available from the Metropolitan Museum, which consist of over 420,000 artworks in its collection. Being able to analyze the entire collection of one of the most comprehensive collections of art and artifacts seems like a dream project for an art nerd. However, with my limited knowledge and time-constraints, the idea was quickly vetoed. Nonetheless, during my research image processing with python, I realized that OpenCV is a powerful tool that can help with analyzing images and videos.

OpenCV or Open Source Computer Vision Library (http://opencv.org), is used for all kinds of image and video processing and analysis. It is capable of processing images and videos to identify objects, faces, or even handwriting. When integrated with various libraries, such as Numpy, Python is capable of processing the OpenCV array structure for analysis. OpenCV converts computer vision of visual information into the vector space. From the vector space, we can identify image pattern and features, and perform mathematical operations on these features.

https://medium.com/machine-learning-world/feature-extraction-and-similar-image-search-with-opencv-for-newbies-3c59796bf774

In the visual example above, feature extraction is performed on a grey scale image, detect the gradients from one specific point, and then and then we can build vector descriptors based on these .

I thought it would be helpful to see what it looks like to start working with an image.

running these lines in python opened up the image specified in the directory, in this case, it’s the jerry showed below

Another feature of OpenCV is to convert images into different color scales in order to better identify the features of the image.

These code created a gray-scale version of the same image, showed below

Moreover, OpenCV also has drawing functions that allow you to mark up an image or add text to the image.

the putText method marks up the image with the specified text in specific font, showed below
this has the potential of creating really funny memes

In addition to potentially creating really interesting memes with randomized text that can be added to an image, I look forward to gaining more experience using OpenCV to find features in images and be able to run Machine Learning algorithms on these images in the future.

Finally, to end this very brief introduction into OpenCV and some of its very rudimentary functions, let’s destroy all the jerry windows. rudimentary functions, let’s destroy all the jerry windows.

The End

Additional resource:

Catherine Huang

Written by

Aspiring Data Scientist. Passionate and curious for all thing data

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade