Chapter 6 is by far the longest chapter inside Practical Python and OpenCV, but it was long for a reason. We covered a lot of important image processing concepts that form the foundation on which the rest of your computer vision education will be built.

In fact, I would recommend reading through this chapter at least once more to ensure you have grasped the basics.

Additional help with basic image operations

That said, after going through the Image Processing chapter multiple times, if you still feel the need to practice with more example code and images, please refer to this blog post, where I include a few more examples of resizing, rotating, and cropping:

basic-saved

Where I include a few more examples of resizing, rotating, and cropping.

Why do we change color spaces?

One concept in Practical Python and OpenCV that I couldn’t go into as much detail as I would have liked is color spaces.

Why do we bother changing color spaces?

What’s the big deal?

We already have RGB; isn’t that good enough?

While RGB is easy to understand (especially when you’re first getting started in computer vision), it’s unintuitive when defining exact shades of a color if you need to define a particular range of colors (useful when tracking objects in a video stream based on color appearance).

The HSV color space tends to be more intuitive in terms of actually defining a particular color (or range), but it doesn’t do a great job of representing how humans see and interpret color.

Then we have the L*a*b* color space — this color space tries to mimic the methodology in which humans see and interpret color. This implies that the Euclidean distance between two arbitrary colors in the L*a*b* color space have actual perceptual meaning.

The addition of the perceptual meaning property makes the L*a*b* color space less intuitive and easy to understand than RGB or HSV, but because of the perceptual meaning property, we often use it in computer vision.

For example, we can apply the L*a*b* color space and the k-means clustering algorithm to find the dominant colors in an image:

jurassic-park-colors

We can also use this same methodology as a form of color quantization, thereby reducing the total number of colors in an image:

quant_kmeans_nature

Finally, we can even transfer the color space between two images, leading to a very cool application of computer vision:

sunset_ocean

I’ve given all these examples of the L*a*b* color space in action, but that doesn’t mean we should ignore RGB or HSV.

In fact, HSV is often used for determining color ranges that you would like to track (such as a green ball in a video stream):

ball-tracking-mask

We can also use HSV to extract color histograms (covered in the next chapter) to quantify the contents of an image and even build an image search engine:

searching

As a final example of applications of the HSV color space, we can use it to apply skin detection as well:

skin_detection_face

We can accomplish a lot with the right color space. Be sure to take a look at these examples, as they will certainly help you on your computer vision journey.

Lesson Content
0% Complete
0/18 Steps