這是可能通過otsu方法找到一個好的二進制圖像?這樣的圖像可以通過otsu方法找到一個好的二值圖像嗎?
這樣的圖像的使用方法大津不顯示我試圖爲這個圖像的任何閾值,良好的輸出值化:
這裏是我的代碼:
A=imread('a6.jpg');
im=rgb2gray(A);
figure,imshow(im); title('gray image');
im=A(:,:,1);
[q r]=size(im);
s=r/2;
if true
%code
n1 = im(:, 1 : end/2); %image(x,y,c) c is matrix displayed as image
n2 = im(:, end/2+1 : end);%indicate last array index
if true
D=imhist(n2)-imhist(n1);
thresh_level = graythresh(D); %find best threshold level
c=zeros(size(im));
[r c1] = size(im);
allpix=im;
allpix(allpix>thresh_level*200)=1;
allpix(allpix<=thresh_level*0)=0;
c=allpix;
figure,imshow(c); title('binary image');
end
end
是否有任何閾值我可以得到一個良好的二進制圖像?
所以,你要求你的程序實現了大津的方法是什麼? – flawr
當然輸出圖像'c'不是一個二進制圖像。此外,似乎有很多不必要的代碼,請保持您的示例最小化。 – flawr
我不明白爲什麼它不是一個二進制圖像,並且實現不是otsu方法。如果你解釋一下,它對我有幫助。 –