Skip to content
BENIBIX Learn

OpenCV

AI🦾 Robotics & VisionRobotics Software

Also known as Open Source Computer Vision Library, cv2, opencv-python

A free library of tools for working with images and video. Python calls it cv2.

Think of it like

It is like a big toolbox for photos. Each tool does one job, like cut, blur or find edges.

Example

Jack's robot uses OpenCV to read each camera frame, shrink it, and turn it grey. Then his model looks for red cups.

Why it matters

Most vision projects need the same basic steps. OpenCV gives them ready-made, so you can start on the real problem.

Definition

OpenCV is a free, open source library of computer vision tools. It has thousands of ready-made functions for images and video. They can resize, crop, blur, find edges, track motion or run a trained model. It is written in C++ and is often used from Python, where you import it as cv2. Robots, phone apps and factory cameras all use it.

Example code

python
import cv2
img = cv2.imread("cup.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 100, 200)
cv2.imwrite("edges.jpg", edges)
Read a photo, turn it grey, find the edges, then save the result.
OpenCV runs one small step at a time. Colour, grey, edges, then the found cup.

Common mistake

Forgetting that OpenCV loads colour photos in blue, green, red order. Shown in another tool, a red cup can look blue.

Key takeaways

  1. 1
    Ready-made tools. Resize, blur, edges and more.
  2. 2
    C++ inside. Fast code under a Python wrapper.
  3. 3
    Free to use. Open source, even for business.