How to run nested loop (from 1 to mean value) & (from mean value to last value) of an image?

1 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

KALYAN ACHARJYA
KALYAN ACHARJYA il 18 Gen 2021
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 Commenti
KALYAN ACHARJYA
KALYAN ACHARJYA il 24 Gen 2021
Modificato: KALYAN ACHARJYA il 24 Gen 2021
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)?
Jagdeep S
Jagdeep S il 25 Gen 2021
Modificato: Jagdeep S il 25 Gen 2021
I divide image into two subimages (I1 & I2). Now i want to get pdf of both subimages & then cdf & at last merge both subimages into one. so in above code i dont know how to add pdf function
In image PL gives pdf of values <= mean & PU gives pdf of values > mean & then cdf of both subimages

Accedi per commentare.

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by