Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
