Matlab图像二值化

时间:2026-02-14 20:36:04

1、首先读取到一张图片

I = imread('fordebug.bmp');

Matlab图像二值化

2、用graythresh和im2bw命令

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

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

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

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

Matlab图像二值化

3、说明:

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

  2.im2bw 为二值转换函数

 效果就出来了!

Enjoy!

© 2026 智德知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com