OpenCV  4.1.0-pre
Open Source Computer Vision
Creating Bounding boxes and circles for contours

Prev Tutorial: Convex Hull

Next Tutorial: Creating Bounding rotated boxes and ellipses for contours

Goal

In this tutorial you will learn how to:

Theory

Code

Explanation

The main function is rather simple, as follows from the comments we do the following:

The callback function does all the interesting job.

We found everything we need, all we have to do is to draw.

Result

Here it is:

Bounding_Rects_Circles_Source_Image.jpg
Bounding_Rects_Circles_Result.jpg