For loop each RGB image channel
이전 댓글 표시
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))
채택된 답변
추가 답변 (1개)
Image Analyst
2021년 11월 8일
0 개 추천
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:
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!