Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
OpenCV Articles
Found 107 articles
Animate image using OpenCV in Python
Animated images are sequences of static images played continuously to create dynamic visual content. They're smaller than videos and widely supported across web and mobile platforms. OpenCV provides powerful tools to create animated effects by manipulating image sequences in Python. What is OpenCV? OpenCV (Open Source Computer Vision Library) is a comprehensive library for computer vision, machine learning, and image processing. Originally developed by Gary Bradsky at Intel in 1999, it now supports multiple programming languages including Python, C++, and Java across various platforms. OpenCV provides extensive functionality for image manipulation, video processing, and real-time computer vision ...
Read MoreHolistically-Nested Edge Detection with OpenCV and Deep Learning
Holistically-Nested Edge Detection (HED) is a deep learning-based method for detecting edges in images using convolutional neural networks. First introduced by Xie and Tu in 2015, HED has gained popularity for producing accurate and high-quality edge maps by learning edge features directly from image data. In this article, we will explore the basics of HED, how it works, and how to implement it using OpenCV and deep learning. What is HED (Holistically-Nested Edge Detection)? Edge detection is an important computer vision task that involves identifying sharp discontinuities in images. These edges serve as the foundation for more ...
Read MoreDraw a triangle with centroid using OpenCV
The centroid (geometric center) of a triangle is the point where all three medians intersect. It can be calculated by taking the average of the x and y coordinates of all three vertices. Centroid A B C Centroid Formula For a triangle with vertices A(x1, y1), B(x2, y2), and C(x3, y3), the centroid is calculated as ? Centroid = ((x1+x2+x3)/3, (y1+y2+y3)/3) In this article, we will draw a triangle with its centroid using OpenCV in Python. ...
Read MoreConnect new point to the previous point on a image with a straight line in OpenCV-Python
In OpenCV-Python, we can draw lines between points on an image to create paths, track movements, or create interactive drawing applications. This is particularly useful for computer vision applications where user interaction is required. OpenCV (Open Source Computer Vision Library) provides powerful functions for image manipulation and computer vision tasks. In this article, we will learn how to connect mouse-clicked points on an image with straight lines using OpenCV-Python. Understanding the cv2.line() Function To draw a straight line between two points, OpenCV provides the cv2.line() function with the following syntax: cv2.line(image, start_point, end_point, color, thickness) ...
Read MoreConvert BGR and RGB with Python and OpenCV
OpenCV is a library of programming functions primarily for real-time computer vision. The library is cross-platform and licensed as free and open source software under the Apache License. It is written in C++ and has Python bindings that make it easy to use in Python applications. In this article, we will learn how to convert between BGR and RGB color formats using Python and OpenCV. Before proceeding, let's understand what BGR and RGB are and why conversion is necessary. What are BGR and RGB? RGB and BGR are both color models used to represent colors in digital ...
Read MoreHow to detect license plates using OpenCV Python?
License plate detection is a crucial component in automated vehicle recognition systems. We can detect license plates in images using OpenCV's Haar cascade classifier, which is a machine learning-based object detection method. What is Haar Cascade Classifier? A Haar cascade classifier uses machine learning to detect objects in images. To train a license plate classifier, the algorithm needs many positive images (with license plates) and negative images (without license plates). Once trained, it can detect license plates in new images. Downloading the Haarcascade File You can download pre-trained Haar cascades from the OpenCV GitHub repository: ...
Read MoreSmile detection using haar cascade in OpenCV using Python
Smile detection using Haar cascade classifiers in OpenCV is a powerful computer vision technique. Haar cascades are pre-trained machine learning models that can detect specific features like faces and smiles in images using pattern recognition. Understanding Haar Cascade Classifiers A Haar cascade classifier is trained on thousands of positive images (containing the target feature) and negative images (without the feature). For smile detection, we need two cascades: haarcascade_frontalface_default.xml − detects faces haarcascade_smile.xml − detects smiles within face regions Downloading Haar Cascades You can download pre-trained Haar cascades from the official OpenCV GitHub repository: ...
Read MoreHow to find patterns in a chessboard using OpenCV Python?
Finding chessboard patterns is essential for camera calibration and computer vision applications. OpenCV provides two key functions: cv2.findChessboardCorners() to detect corner points and cv2.drawChessboardCorners() to visualize the detected pattern. Syntax ret, corners = cv2.findChessboardCorners(img, patternSize, None) cv2.drawChessboardCorners(img, patternSize, corners, ret) Parameters img − Input grayscale image patternSize − Number of inner corners per row and column (width, height) corners − Output array of detected corner coordinates ret − Boolean indicating if pattern was found Steps To find chessboard patterns, follow these steps − Import the required library. In ...
Read MoreHow to detect cat faces in an image in OpenCV using Python?
Cat face detection in images uses Haar cascade classifiers, a machine learning approach trained on positive images (with cat faces) and negative images (without cat faces). OpenCV provides a pre-trained Haar cascade specifically for cat face detection. Downloading the Haar Cascade You can find the required Haar cascade file at the official OpenCV GitHub repository ? https://github.com/opencv/opencv/tree/master/data/haarcascades Download haarcascade_frontalcatface.xml by clicking on the file, opening it in raw format, then right-clicking and saving it to your project directory. Steps for Cat Face Detection Import OpenCV and read the input image Convert the image ...
Read MoreHow to crop and save the detected faces in OpenCV Python?
OpenCV provides Haar cascade classifiers for detecting faces in images. When a face is detected, you get coordinates (x, y, w, h) representing the face's position and dimensions. To crop and save the detected face, we use array slicing: image[y:y+h, x:x+w]. How to Download Haar Cascades You can find different Haar cascades on the GitHub repository: https://github.com/opencv/opencv/tree/master/data/haarcascades To download the Haar cascade for human face detection, click on the haarcascade_frontalface_default.xml or haarcascade_frontalface_alt.xml file. Open it in raw format, right-click and save the file. Note: Save all Haar cascade XML files in a dedicated folder for ...
Read More