上QQ阅读APP看书,第一时间看更新
Setting a rectangular area to a specified color
The problem of altering the color of a rectangular area of our choice is a little different in the case of color images. In Chapter 2, Working with Pixels in Grayscale Images, you learned two different ways to alter pixel values in such a task; through using for loops and through indexing.
In a simple case, using the same value for all the color channels, the two aforementioned methods can still be used, but in the case of different values in each color channel, the problem becomes a little more complicated. Let's see these things using a practical example.