For loop each RGB image channel
Afficher commentaires plus anciens
I want to make this manual saperated RGB channel code into for loop, each channel will undergo the same calculation. Can anybody help me how to convert it into for loop code?
here the image: 

t = imread ('luekemia.png')
%% black & white
bw = imbinarize (t,0.4);
bw = ~bw;
%% remove noise
bw2 = bwareaopen (bw,100);
%%separate 3 layer RGB
R = t(:,:,1);
G = t(:,:,2);
B = t(:,:,3);
R(bw2(:)==0) = 255;
G(bw2(:)==0) = 255;
B(bw2(:)==0) = 255;
c = cat(3,R,G,B);
%calculate range R
rmax = max(R(bw2(:)~=0))
rmin = min(R(bw2(:)~=0))
gmax = max(G(bw2(:)~=0))
gmin = min(G(bw2(:)~=0))
bmax = max(B(bw2(:)~=0))
bmin = min(B(bw2(:)~=0))
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 8 Nov 2021
0 votes
Not sure what analysis you want to do (you didn't say what the "calculations" were) but I just thought I'd point you to a similar example by the Mathworks:
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!