Shahid Akhtar Khan has Published 216 Articles

How to draw filled ellipses in OpenCV using Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 08:32:23

2K+ Views

To draw a filled ellipse on an image, we use the cv2.ellipse() method. This method accepts different arguments to draw different types of ellipses. Syntax cv2.ellipse(img, center, axes, angle, start_angle, end_angle, color, thickness) Parameters img − The input image on which the ellipse is to be drawn. center ... Read More

How to detect a triangle in an image using OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 08:28:56

4K+ Views

To detect a triangle in an image, we first detect all the contours in the image. Then we loop over all the contours. Find the approximate contour for each of the contours. If the number of vertex points in the approximate contour is 3, then draw the contour and set ... Read More

How to perform bitwise XOR operation on images in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 08:13:59

2K+ Views

Color images (RGB) have three channels: red, blue and green. The image is represented as a 3-dimensional numpy array. The pixel values of an image are stored using 8-bit unsigned integers (uint8) in the range "0 to 255". The bitwise XOR operation on two images is performed on the binary ... Read More

How to check if an image contour is convex or not in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 08:09:54

1K+ Views

The function cv2.isContourConvex() is used to check whether a curve (contour) is convex or not. A contour of an object in the image is a curve joining all the continuous points along the boundary, having the same color or intensity. Contours are used for shape analysis and object detection and ... Read More

How to Compute Image Moments in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 07:17:39

4K+ Views

Image Moments are very important to compute the features like center of mass of an object, area of an object, etc., in a given image. Image moments are computed for an object using the contour of the object. So first, we detect the contour of the object, then apply cv2.moments(cnt) ... Read More

How to match image shapes in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 07:11:54

5K+ Views

We use cv2.matchShapes() function to match two image shapes. This function returns a metric showing the similarity between the image shapes. This function uses Hu-Moments to calculate the metric value. Lower the metric value, higher the similarity between the image shapes. In the following examples, we will match the shapes ... Read More

How to find Laplassian pyramids for an image using OpenCV in Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 07:09:23

1K+ Views

We can form the Laplacian Pyramids from the Gaussian Pyramids. OpenCV does not provide any specific function to construct Laplacian Pyramids. In Laplacian pyramid, images look like edge images only. Laplacian Pyramids are used in image compression as well as in image enhancement. A level in the Laplacian Pyramid is ... Read More

How to find Gaussian pyramids for an image using OpenCV in Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 06:58:20

903 Views

In many cases, we need to work with different resolutions and sizes of the same image. In the concept of image pyramid, we find images with different resolutions and sizes of the original image. The Gaussian pyramid is a type of image pyramid. To find a Gaussian pyramid, OpenCV provides ... Read More

How to find image gradients using the Scharr operator in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 28-Sep-2022 06:54:05

536 Views

Using the Scharr operator, we can compute image gradients in horizontal as well as vertical direction using first order derivatives. The gradients are computed for a grayscale image. You can apply Scharr operation on an image using the method cv2.scharr(). Syntax The following syntax is used to compute the image ... Read More

How to draw polylines on an image in OpenCV using Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 27-Sep-2022 14:01:39

4K+ Views

To draw polylines on an image, we use the method cv2.polylines(). We can draw open or closed polylines on the image. The first and last points are not connected while drawing an open polyline. Syntax The syntax of cv2.polylines() is as follows − cv2.polylines(src, [pts], isClosed, color, thickness) Parameters ... Read More

Previous 1 ... 6 7 8 9 10 ... 22 Next
Advertisements