Part I - Color Threshold

Explanation
Similar to Gray Threshold previously, the same concept of threshold is applied. Instead of using gray values, the RGB components are compared directly with the threshold, then altered accordingly. Setting a component value to 0 will result in that particular color’s absence, while setting it to 255 will increase the intensity of that component’s color.

Optimal threshold value is obtained by first constructing a histogram for each of the RGB component. The mean is then calculated separately to get the optimal value to be used as a threshold. The expected outcome is an image clear enough to be identified as similar with the original image, only with colors adjusted. Output is as below:





Question

  1. Explain how many different colours are possible using this method of ‘binary’ thresholding?
Thresholding is a method of image segmentation and as such, it can be used to create binary images. Binary images only have two possible values for each pixel, hence the different combinations can be calculated as 2^x where x is the number of pixels.

Reflection 
The challenge posed in this requirement is how to calculate the mean given that the histogram is only constructed using a 2D array. For each histogram index, it is multiplied with the number of counts and then summed up. That value is then divided by the sum of all indexes to obtain the mean value. In the previous requirement, we dealt with grayscale. Here, we alter the RGB components independently. Lena looks much more fanciful now that the colors are brighter.

No comments:

Post a Comment