Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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=
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago