MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]关于matlab Otsu阈值分割中的阈值问题!!! (https://www.labfans.com/bbs/showthread.php?t=5990)

daocaoren_508 2008-12-22 21:22

[求助]关于matlab Otsu阈值分割中的阈值问题!!!
 
用Otsu方法进行图像阈值分割:
I = imread('coins.png');
level = graythresh(I);
BW = im2bw(I,level);

可是求得的level为什么是0到1之间的数呢?
怎样求实际的阈值?

假如一个灰度图像每个像素点的灰度值是0到255之间,用最大类间方差法求得的阈值也应该是0到255之间的一个数,为什么会是0到1之间呢? 怎样求得实际阈值呢?

例如:灰度图像img的矩阵如下:
img =
[ 0 0 0.1000 10.0000 11.0000
9.0000 7.0000 250.0000 224.0000 234.0000
8.0000 6.0000 219.0000 220.0000 1.0000
255.0000 233.0000 7.0000 6.0000 2.0000 ]
>> level = graythresh(img);
求得阈值:
level =0.5490
但是将上述图像的像素点分为两类的阈值很明显应该是11和219之间的一个数!!!???:confused:
有点糊涂了~~~~~~~~~~~~~~~~~~~~~~~~~~~

daocaoren_508 2008-12-23 09:20

回复: [求助]关于matlab Otsu阈值分割中的阈值问题!!!
 
有人能帮忙解释一下吗? 看起来好像不是很难的问题~~

daocaoren_508 2008-12-23 19:25

回复: [求助]关于matlab Otsu阈值分割中的阈值问题!!!
 
继续求助。。。。。。:cry:

johnny8088 2009-01-31 03:51

回复: [求助]关于matlab Otsu阈值分割中的阈值问题!!!
 
[QUOTE=daocaoren_508;22588]用Otsu方法进行图像阈值分割:
I = imread('coins.png');
level = graythresh(I);
BW = im2bw(I,level);

可是求得的level为什么是0到1之间的数呢?
怎样求实际的阈值?

假如一个灰度图像每个像素点的灰度值是0到...[/QUOTE]



I cannot believe nobody answers this question.
I believe anybody seriously working on image processing uses Otsu's method a lot.
Yes, the threshold is between 0-1.
If you want the actual number, simply use this

actual_level=255*level;

Why the level is between 0-1? it is normalized because some image gray levels are not between 0-255. The gray levels can be in 0-2^(16)-1. So when normalized, the threshold is same for all types of images.

I wish this answers your question.

tolabfans 2009-02-04 11:03

回复: [求助]关于matlab Otsu阈值分割中的阈值问题!!!
 
matlab自动归一化了吧。乘个256就行了


所有时间均为北京时间。现在的时间是 13:24

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.