After finding the threshold, how can i redraw the histogram and the image using the new thresold value

2 visualizaciones (últimos 30 días)
This is the code to find the thresold
clc; clear all; close all;
i= imread('cameraman.jpg'); [m,n]=size(i); figure, imshow(i);
[rows, columns, numberOfColorBands] = size(i)
if numberOfColorBands > 1 i = i(:, :, 2); % Take green channel. end
[y x]=imhist(i)
figure(2), imhist(i);
p=y/(m*n);
t=100;
while true
disp(t);
m1=(x>t);
u1= sum(x(m1).*p(m1))/sum(p(m1));
m2=(x<=t);
u2= sum(x(m2).*p(m2))/sum(p(m2));
tnew=(u1+u2)/2;
if t==tnew
break;
else
t=tnew;
end
end
After finding the threshold, how can i redraw the histogram and also the cameraman image by using the new threshold value.
can anyone help me in this.
Thank you

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by