From the course: Building Computer Vision Applications with Python
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Weighted grayscale
From the course: Building Computer Vision Applications with Python
Weighted grayscale
- [Instructor] Average grayscale doesn't always look very natural to the human eye or brain. A more natural alternative is to calculate a weighted average with different weights for red, green and blue based on luminance or human perception. A popular distribution of weights is 0.299 for red, 0.587 for green and 0.114 for blue. Let's work with the Playspace image again. In the next cell, let me create the same average we calculated before in line four and a weighted average in line five. Notice the distribution of weights. Now let's print both pictures side by side, as you can see, starting at line eight. Here we have the regular average at the left and the weighted average at the right. Try to notice the difference in the shades of gray. Notice how the truck and the mat at the back look different. Now let's see it again in the fruit picture. Here's the color version. And here we have the grayscale versions. One…
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.