Question: 1 . 3 . 5 Color - Filter an image The functionality of the color filter is to change the selected color in the picture

1.3.5 Color-Filter an image
The functionality of the color filter is to change the selected color in the picture to the color the user wants. To do that,
first the user has to choose the color by entering the RGB intensity and the threshold of the color the user wants to
modify. Also, the users have to enter the replacement value for each RGB component. All pixels in the picture with
color in the chosen range will be replaced with new color. The following shows the pseudo code for the color filter.
if (R in the range of [target_r - threshold, target_r + threshold]) and
(G in the range of [target_g - threshold, target_g + threshold]) and
(B in the range of [target_b - threshold, target_b + threshold])
R= replace_r ;
G= replace_g ;
B= replace_b;
else
keep the current color
You need to define and implement the following function to do this DIP. Note that your program should check boundary
for the new color values, i.e. the intensity should be in the range of 0,255.
/* color filter */
void ColorFilter(unsigned char R[WIDTH][HEIGHT],
unsigned char G[WIDTH][HEIGHT],
unsigned char B[WIDTH][HEIGHT],
int target_r, int target_g, int target_b, int threshold,
int replace_r, int replace_g, int replace_b);
Figure 3 shows an example of this operation. In this example, we change the color of the building from red to blue by
setting the target ?r=130, target ?g=130, target ?b=150, threshold =30, replace ?r=0, replace g=255, replace b=
 1.3.5 Color-Filter an image The functionality of the color filter is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!