top of page



Start Python for Image Processing with OpenCV and ML -Part 5 Object Detection

Similar with “Object Recognition”, “Object Detection” is also a widely used phrase in modern society especially when it comes to Image procession related to AI. Detection is concerned with identifying and localizing objects of interest within an image or a video frame, while recognition focuses on what is presented rather than where it is. To step further, we may need to draw a bounding box or a mark where the object shows.

Object detection could be accomplished by both classical OpenCV image processing methods and machine learning. When we use classical image processing methods for object detection, the object could be some common ones, like corner, edge, grid, contour, etc. When we use machine learning methods, we may need to apply it to some particular objects, like people, face, etc.

We will introduce some important classical OpenCV methods followed by a typical machine learning example of Facial & Eye Detection in OpenCV.

1. Edge Detection & Contour Detection

We usually use edge detection and contour detection together in practice to detect contours in an image. Please check the tutorial documents here for the two methods for more information.



Let us see the example.

2. Facial & Eye Detection

We use haar ascade classifier, which is actually pretrained from a machine learning algorithm and lots of positive and negative pictures beforehand. In OpenCV we could use it by calling


Please check the link for more information. We only focus on how to use it in python, and here is the example.

Please feel free to contact if you have any comments.

Stay tuned for the next part, coming next month!





bottom of page