From the course: OpenCV for Python Developers
Segmentation and binary images
From the course: OpenCV for Python Developers
Segmentation and binary images
- [Instructor] In this chapter, we are focused on extracting features and objects from images. An object is the focus of our processing. It's a thing that we actually want to get to do further work. In order to get the objects out of an image, we need to go through a process called segmentation. Segmentation can be done through a variety of different ways, but the typical output is a binary image. A binary image is something that has values of zero or one. Essentially a one indicates the piece of the image that we want to use and a zero is everything else. Binary images are a key component of many image processing algorithms. These are pure non-alias black and white images, the results of extracting out only what you need. They act as a mask for the area of the source image. After creating a binary image from the source you can do a lot when it comes to image processing. One of the typical ways to get a binary image is to use what's called a thresholding algorithm. This is a type of segmentation that does a look at the values of the source image and a comparison against one central value to decide whether a single pixel or group of pixels should have a value of zero or one. And the top example on this slide, we can see that the binary threshold applied looks at every pixel and the image on the left to see if the value is greater than or equal to 128. If it is, it is assigned the value of one. Anything less than that is assigned the value of zero. On the bottom example, the binary threshold is based around the value of 64. Therefore, everything that has a value of 64 on the left hand image, is assigned to one. This is a very simple example of segmentation. We'll go more into it into the next steps and explore more advanced methodologies later in this chapter.
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
-
-
-