Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help me complete or fix this code so I get around 2 5 0 0 pixels in the attached image with Matlab: I = imread
Help me complete or fix this code so I get around pixels in the attached image with Matlab:
I imreadMnMstif";
I imdoubleI;
Apply median filter
CImed I;
for Layer :
CImed::Layer medfiltCImed::Layer;
end
Apply max filter to the median filtered image
CI CImed;
for Layer :
CI::Layer ordfiltCI::Layer ones;
end
R CI::;
G CI::;
B CI::;
Initialize color matrices
Wh zeros; White
Re zeros; Red
Gr zeros; Green
Bl zeros; Blue
Gy zeros; Gray
Pi zeros; Pink
Pu zeros; Purple
Ol zeros; Olive
Br zeros; Brown
BB zeros; Background
missing zeros; Missing
Adjust thresholds and conditions
for m :
for n :
miss ;
if Rnm && Gnm && Bnm
Whnm;
miss ;
end
if Rnm && Gnm && Bnm
Renm;
miss ;
end
if Rnm && Gnm && Bnm
Grnm;
miss ;
end
if Rnm && Gnm && Bnm
Blnm;
miss ;
end
if Rnm && Gnm
Gynm;
miss ;
end
if Rnm && Gnm && Bnm
Pinm;
miss ;
end
if Rnm && Rnm
Punm;
miss ;
end
if Rnm && Rnm
Olnm;
miss ;
end
if Gnm && Gnm
Brnm;
miss ;
end
if Rnm && Gnm && Bnm
BBnm;
miss ;
end
if miss
missingnm;
end
end
end
Display the results
figure
subplot; imshowI; titleOriginal image: numstr;
subplot; imshowWh; titleWhite: numstrsumsumWh;
subplot; imshowRe; titleRed: numstrsumsumRe;
subplot; imshowGr; titleGreen: numstrsumsumGr;
subplot; imshowBl; titleBlue: numstrsumsumBl;
subplot; imshowGy; titleGray: numstrsumsumGy;
subplot; imshowPi; titlePink: numstrsumsumPi;
subplot; imshowPu; titlePurple: numstrsumsumPu;
subplot; imshowOl; titleOlive: numstrsumsumOl;
subplot; imshowBr; titleBrown: numstrsumsumBr;
subplot; imshowBB; titleBackground: numstrsumsumBB;
subplot; imshowmissing; titleMissing: numstrsumsummissing;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started