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
Server Side Programming Articles
Page 121 of 2109
Draw Multiple Rectangles in Image using OpenCV Python
OpenCV is an Open Source Computer Vision Library in Python that provides numerous functions to perform various image and video processing operations. In this article, we will explore different ways to draw multiple rectangles in an image using OpenCV Python. To draw rectangular shapes on an image, OpenCV provides the cv2.rectangle() method which can be used in various approaches to create multiple rectangles efficiently. The cv2.rectangle() Function The cv2.rectangle() method draws rectangular shapes on an image. Following is the syntax ? cv2.rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) Parameters img: The ...
Read MoreRemoving Black Background and Make Transparent using OpenCV Python
In digital images, transparency is the functionality that supports transparent areas in an image or image layer. For image processing and editing, background removal allows us to highlight the subject of the photo and create a transparent background to place the subject into various new designs and destinations. Certain image formats do not support transparency. For example, PNG, TIFF, and WebP graphics formats support transparency, whereas JPEGs do not. In this article, we will see how to remove the black background from an image to make it transparent using OpenCV Python. Like RGB channels, the alpha channel is ...
Read MoreDraw a rectangular shape and extract objects using Python\'s OpenCV
OpenCV is an Open Source Computer Vision Library in Python. It provides numerous functions to perform various image and video processing operations. The library uses the NumPy module to represent all video frames and images as ndarray types. In this article, we will see different ways to draw rectangular shapes and extract objects using Python OpenCV. Drawing a Rectangle To draw a rectangular shape on an image, Python OpenCV provides the cv2.rectangle() method. Following is the syntax ? Syntax cv2.rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) Parameters img: The source ...
Read MoreDisplay date and time in videos using OpenCV Python
OpenCV is an Open Source Computer Vision Library in Python that provides numerous functions for image and video processing operations. When building live streaming or video processing applications, you often need to display timestamps on video frames. This can be achieved using OpenCV's cv2.putText() function combined with Python's datetime module. The cv2.putText() Function OpenCV provides the cv2.putText() method to write text strings on image or video frames ? Syntax cv2.putText(img, text, org, fontFace, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) Parameters img: Input image/frame text: Text string to be drawn org: Tuple of ...
Read MoreClick response on video output using Events in OpenCV and Python
OpenCV is an Open Source Computer Vision Library in Python that provides numerous functions for image and video processing operations. It uses NumPy arrays to represent video and image data efficiently. In this article, we will learn how to handle mouse click events on video output using OpenCV's event handling system. This allows us to create interactive video applications that respond to user clicks. Mouse Events in OpenCV OpenCV provides several mouse event constants to detect different types of mouse interactions ? cv2.EVENT_LBUTTONDOWN: Left mouse button is pressed cv2.EVENT_RBUTTONDOWN: Right mouse button is pressed cv2.EVENT_MBUTTONDOWN: ...
Read MoreCheck if the camera is opened or not using OpenCV Python
OpenCV is an Open Source Computer Vision Library in Python that provides numerous functions for image and video processing operations. When working with cameras, it's essential to verify if the camera is accessible before attempting to capture frames to avoid runtime errors. In this article, we will explore different methods to check if a camera is opened and accessible using OpenCV Python. The Problem: Unchecked Camera Access When we try to access a camera without checking its status, our program may encounter errors if the camera is unavailable, already in use, or malfunctioning. Example of Problematic ...
Read MoreDividing Images Into Equal Parts Using OpenCV Python
The Python OpenCV library enables us to utilize a variety of image-processing tools, like image classification, face/object detection, tracking, and more. In this article, we will use Python list slicing or NumPy array slicing techniques to divide an image into equal parts, since OpenCV-Python uses NumPy arrays to store image data and pixel values. Input Output Scenarios Assuming we have an input image, in the output we will see the equally divided parts of the given image. Approach We will follow the below steps to divide the images into equal parts ? ...
Read MoreWhite and black dot detection using OpenCV Python
OpenCV Python is a powerful image processing library that uses NumPy arrays to store image data. This allows us to efficiently detect and count objects like white and black dots in images. The cv2.findContours() method is used for detecting objects in binary images. We'll use this method along with thresholding techniques to detect white and black dots ? Syntax cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]]) Parameters: image − 8-bit single-channel binary image mode − Contour retrieval mode method − Contour approximation method Approach Follow these steps to detect white and ...
Read MoreCheck if the image is empty using OpenCV Python
OpenCV is an Open Source Computer Vision Library in Python. It is one of the most popular image processing libraries and uses NumPy arrays to represent images. In this article, we will explore different methods to check if an image is empty or blank using OpenCV Python. Input-Output Scenarios We'll work with a blank input image and demonstrate how to programmatically detect whether an image is empty ? Input Image Expected Output Image is empty Method 1: Using Unique Pixel Count An empty image typically has very few unique ...
Read MoreSplitting and Merging Channels with OpenCV Python
A standard digital color image is represented by pixels, where each pixel is a combination of primary colors. A channel is a grayscale image that represents only one primary color component of a colored image. For example, an RGB image has three channels: red, green, and blue. Observe the below colored images to see how each channel looks separately: Below grayscale images are the representation of each channel of the RGB image. In this article, we will discuss how to split and merge channels of an image using Python OpenCV library. Splitting ...
Read More