niblack 二值化算法源程序 matlab

基于matlab的niblack 二值化算法源程序 ,希望对大家有帮助

 

function imagBW = niblack(imag)
% NIBLACK binarizes a gray scale image 'imag' to a binary image, using
% Niblack algorithm. The noises of the gray scale image are removed.
%  Input:
%       imag: the gray scale image, with black foreground(0), and white
%       background(255).
%  Output:
%       imagBW: the binary image of the gray scale image 'imag', with
%       Niblack algorithm.

% Reference:
%   Wayne Niblack. An Introduction to Digital Image Processing. pp: 115.
%   1986. Prentice/Hall International. ISBN: 013 480674 3

tic;

k = -0.2;  % the first manual parameter
b = 80;   % the second manual parameter, about the width of the square neighborhood
choice = 1; % 1 for pixel-to-

你可能感兴趣的:(niblack 二值化算法源程序 matlab)