From the course: OpenCV for Python Developers
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Area, perimeter, center, and curvature
From the course: OpenCV for Python Developers
Area, perimeter, center, and curvature
- Now that we have segmented out and individually bounded contours of objects in the previous video, let's keep going and extract more information from each of these individual objects. Specifically, we're going to be looking at the area, perimeter and centroids of these objects. To begin, I'm going to start off by deleting our last imshow in our draw contours command, and then I'm going to create an empty array called objects which equals np.zeros, and then in parentheses, we're going to specify the original shape of our image and we can do this by typing open square brackets, img.shape and then index 0 for the width. Then img.shape, passing in 1 for the height and then we'll use a channel count of 3, so that can be in color, and then we're going to specify the format of this image, which is going to be uint8. This is going to be a blank canvas for us to draw onto. The next step is to go ahead and create a loop over…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Segmentation and binary images1m 38s
-
(Locked)
Simple thresholding6m 34s
-
(Locked)
Adaptive thresholding4m 38s
-
(Locked)
Skin detection6m 31s
-
(Locked)
Introduction to contours1m 38s
-
(Locked)
Contour object detection6m 56s
-
(Locked)
Area, perimeter, center, and curvature8m 19s
-
(Locked)
Canny edge detection8m 1s
-
(Locked)
Object detection overview1m 59s
-
(Locked)
Challenge: Assign object ID and attributes50s
-
(Locked)
Solution: Assign object ID and attributes10m 5s
-
-
-