% OTSU THRESHOLDING
% X=imread('cameraman.tif')
% a=ones(256,1)*[1:256];
% c2=double(X).*(a/2+50)+(1-double(X)).*a/2;
% c3=uint8(255*mat2gray(c2));
% IDX = otsu(c3,2);
%----------------------------------------------------------
%
% function [IDX,sep] = otsu(I,n)
I = single(I);
%% Convert to 256 levels
I = I-min(I(:));
I = round(I/max(I(:))*255);
%% Probability distribution
unI = sort((I));
nbins = min(length(unI),256);
[histo,pixval] = hist(I(:),256);
P = histo/sum(histo);
%% Zeroth- and first-order cumulative moments
w = cumsum(P);
mu = cumsum((1:nbins).*P);
%% Maximal sigmaB^2 and Segmented image
if n==2
sigma2B =...
(mu(end)*w(1:end-1)-mu(1:end-1)).^2./w(1:end-1)./(1-w(1:end-1));
[maxsig,k] = max(sigma2B);
k
이것은 오츠 임계 값 (2 클래스 만)을 찾는 데 사용하는 코드입니다. 그래서 최적의 임계 값 즉 k를 찾은 후 임계 값 이미지를 계산하는 방법 ?? 각 이미지 픽셀 값을 변경하는 방법 < k = 0 및> = k = 1 그러면 이진 이미지가 생성됩니까?히스토그램 임계 값에서 플로팅
Plz은을 사용하여 흑백 이미지로 이미지 I 변환입니다 ..이 multithresh 가능한 것입니까? – bcool93