Shahid Akhtar Khan has Published 217 Articles

How to detect license plates using OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:24:33

We will use the Haar cascade classifier to detect the license number plate in the image. A haar cascade classifier is an effective object detection method. It is a machine learning based approach. To train a number plate classifier, the algorithm initially needs a lot of positive images (images ... Read More

Smile detection using haar cascade in OpenCV using Python

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:21:42

We will use the Haar cascade classifier for smile detection in an image. A haar cascade classifier is an effective object detection method. It is a machine learning based approach. To train a haar cascade classifier for smile detection, the algorithm initially needs a lot of positive images (images with ... Read More

How to find patterns in a chessboard using OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:19:48

We could find chessboard corners in an image using cv2.findChessboardCorners() and to draw the chessboard corners with a pattern, we could use cv2.drawChessboardCorners(). Look at the below syntaxes for these two methods − ret, corners = cv2.findChessboardCorners(img, patterSize, None) cv2.drawChessboardCorners(img, patternSize, corners, ret) Steps To find the patterns in ... Read More

How to detect cat faces in an image in OpenCV using Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:17:36

A haar cascade classifier is an effective object detection method. It is a machine learning based approach. To train a haar cascade classifier for cat face detection, the algorithm initially needs a lot of positive images (images with cat faces) and negative images (images without cat faces). The classifier is ... Read More

How to crop and save the detected faces in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:15:08

We can use the already trained haar cascade classifier to detect the faces in the image. To detect faces OpenCV provides us with different haar cascades as xml files. We will use haarcascade_frontalface_alt.xml for human face detection in the image. The detected face coordinates are in (x, y, w, h). ... Read More

Implementing k-Nearest Neighbor in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:12:46

k-Nearest Neighbor (kNN) is a simple classification algorithm for supervised learning. To implement kNN in OpenCV, you can follow the steps given below − Import the required libraries OpenCV, NumPy and Matplotlib. We define two classes Red and Blue each having 25 numbers. Then generate training data for these ... Read More

How to detect humans in an image in OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:10:57

To detect humans in an image and draw bounding boxes around them, you can use the steps given below − Import the required library. In all the following examples, the required Python library is OpenCV. Make sure you have already installed it. Read the input image using cv2.imread() in ... Read More

How to detect polygons in image using OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:08:22

We first detect all the object contours in the image to detect a polygon. Then Loop over all contours. Find the approximate contour for each of the contours. If the number of vertex points in the approximate contour is 5 or more then draw the contour and set it as ... Read More

How to detect eyes in an image using OpenCV Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:06:08

A "haar cascade classifier" is an effective machine learning based approach for object detection. To train a haar cascade classifier for eye detection, the algorithm initially needs a lot of positive images (images of eyes) and negative images (images without eyes). Then the classifier is trained from these positive and ... Read More

How to change the contrast and brightness of an image using OpenCV in Python?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 05-Dec-2022 11:04:10

In OpenCV, to change the contrast and brightness of an image we could use cv2.convertScaleAbs(). The syntax we use for this method is as follows − cv2.convertScaleAbs(image, alpha, beta) Where image is the original input image. alpha is the contrast value. To lower the contrast, use 0 < ... Read More

1 2 3 4 5 6 7 ... 22 Next
Advertisements