![]() ![]() Haar features work in a similar fashion to feature maps of regular Convolutional Neural Networks (CNNs). Several XML files come pre-packaged with OpenCV, each of which holds the Haar features for different objects. It's embodied in the cv2.CascadeClassifier class. Now that we are done with the drawing with OpenCV let's take a look at the concept of the Haar Cascade Classifier, how it works, and how it lets us identify objects in an image! Haar-Cascade ClassifierĪ Haar-Cascade Classifier is a machine learning classifier that works with Haar features. That's where OpenCV can do the heavy lifting! Once it does - we can use this exact method to draw a rectangle around the detected object instead.ĭrawing rectangles (or circles) like this is an important step in Object Detection, as it lets us anntoate (label) the objects we detect in a clear way. These locations are something to be inferred from the image, not guessed. Here, we fixed the location of the rectangle with the cv2.rectangle() call. Let's draw a simple rectangular shape in the image using the rectangle() method that takes positional arguments, color, and the thickness of the shape.Īdd a new line to create a rectangle after reading the image and before naming the window: ![]() We can even use a putText() method to put a label with the shape. OpenCV can draw various shapes including rectangles, circles, and lines.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |