Error in multithresh while computing N levels

I'm trying to compute the metrics of an image using multithresh for for N levels 2:20 (maximum allowed). In some of the images I get an error in the loop (see error below) especially at level N(j)=3. I'm not sure why I get this error with some images and not all. Please help.
[~, metric(j)] = multithresh(ROI, N(j) );
Attempted to access omega(-2); index must be a positive integer or logical.
Error in multithresh>objCriteriaND (line 264)
sigma_b_squared_val = omega(boundaries(1)).*((mu(boundaries(1))./omega(boundaries(1)) - mu_t).^2);
Error in multithresh>@(thresh)objCriteriaND(thresh,num_bins,omega,mu,mu_t) (line 148)
[thresh, minval] = fminsearch(@(thresh) objCriteriaND(thresh, ...
Error in fminsearch (line 309)
x(:) = xr; fxr = funfcn(x,varargin{:});
Error in multithresh (line 148)
[thresh, minval] = fminsearch(@(thresh) objCriteriaND(thresh, ... ||

4 件のコメント

SuSo
SuSo 2015 年 8 月 5 日
編集済み: SuSo 2015 年 8 月 5 日
I have been having the same problem with multithresh, using N=3 or N=4. Works for some images but not for others. Have you had any luck finding a solution or a workaround?
Thanks!
John
John 2015 年 8 月 5 日
Hi SuSo, I never got a solution to it. I simply used try/catch statement to skip the errors.
SuSo
SuSo 2015 年 8 月 6 日
Lol that's exactly what I did. Pity. Thanks!
SarTho
SarTho 2016 年 6 月 9 日
I faced the same problem with multithresh und solved it by just applying some light preprocessing filter (gauss etc) on the input.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Convert Image Type についてさらに検索

質問済み:

2015 年 3 月 10 日

編集済み:

2016 年 6 月 9 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by