View on GitHub

【MATLAB】二值化效果

 

比较了几种阈值确定方法

 

imggray = imread('finger.bmp');

subplot(221); imshow(imggray);

title('原始图像');

imgbw = im2bw(imggray,0.5);

subplot(222); imshow(imgbw);

title( '使用默认阈值0.5');

imgbw = im2bw(imggray, 0.25);

subplot(223); imshow(imgbw);

title( '指定阈值为0.25');

level = graythresh(imggray);

imgbw = im2bw(imggray,level);

subplot(224); imshow(imgbw);

title('使用最大类间方差法(Otsu)获得阈值');

 

效果

image


说明:

最大类间方差法是由日本学者大津(Nobuyuki Otsu)于1979年提出的,是一种自适应的阈值确定的方法,又叫大津法,简称OTSU。它是按图像的灰度特性,将图像分成背景和目标2部分。背景和目标之间的类间方差越大,说明构成图像的2部分的差别越大,当部分目标错分为背景或部分背景错分为目标都会导致2部分差别变小。因此,使类间方差最大的分割意味着错分概率最小。

posted @ 2015-03-13 20:11  Blz.Galaxy  阅读(2752)  评论(0编辑  收藏  举报