Matlab图像二值化

2026-03-07 21:45:18

1、首先读取到一张图片

I = imread('fordebug.bmp');

Matlab图像二值化

2、用graythresh和im2bw命令

thresh = graythresh(I);     %自动确定二值化阈值

I2 = im2bw(I,thresh);       %对图像二值化

--------------------------------------------------

--------------------------------------------------

Matlab图像二值化

3、说明:

  1.graythresh命令为 Matlab 自动确定最佳阈值

  2.im2bw 为二值转换函数

 效果就出来了!

Enjoy!

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢