How to run nested loop (from 1 to mean value) & (from mean value to last value) of an image?
조회 수: 1 (최근 30일)
이전 댓글 표시
I divide an image(I) into two subimages (I1 & I2) based on mean value. Now i want to access values of I1 (from 1 to mean value) & I2 (from mean value to last value) to get PDF of image, How to do it?
I = imread('f16.tif');
r=size(I,1);
c=size(I,2);
h1=uint8(zeros(r,c));
h2=uint8(zeros(r,c));
n1=r*c;
n2=r*c;
R=uint8(zeros(r,c));
f1=zeros(256,1);
f2=zeros(256,1);
pdf1=zeros(256,1);
pdf2=zeros(256,1);
cdf1=zeros(256,1);
cdf2=zeros(256,1);
cum1=zeros(256,1);
out1=zeros(256,1);
cum2=zeros(256,1);
out2=zeros(256,1);
Im=mean2(I);
I1=(I(r,c)<=Im);
I2=(I(r,c)>Im);
for i=1:r
for j=1:c
value1=I1(i,j);
f1(value1+1)=f1(value1+1)+1;
pdf1(value1+1)=f1(value1+1)/n1;
end
end
for i=1:r
for j=1:c
value2=I2(i,j);
f2(value2+1)=f2(value2+1)+1;
pdf2(value2+1)=f2(value2+1)/n2;
end
end
댓글 수: 0
답변 (1개)
KALYAN ACHARJYA
2021년 1월 18일
Is this?
mean_val=mean2(grayImage);
Image_I1=grayImage(grayImage>mean_val);
Image_I2=grayImage(grayImage<=mean_val);
subplot(211),imhist(Image_I1);
subplot(212),imhist(Image_I2);
Or
Get the PDF of Image_I1 and I2
https://in.mathworks.com/help/stats/prob.normaldistribution.pdf.html
댓글 수: 3
KALYAN ACHARJYA
2021년 1월 24일
편집: KALYAN ACHARJYA
2021년 1월 24일
If you have checked the Histo distribution map, you can get the answer from there also?? Probability distribution map of pixels onthe particular subimage??
Otherwise, can you define the problem again, what do you have and what are you looking for (as a minimal as possible with necessity information)?
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!