特定の範囲における二値化について(初心者です)
30 views (last 30 days)
Show older comments
二値化において、imbinarizeを用いているのですが、 イメージAの左半分の閾値を右半分の閾値よりも高く設定して二値化したいです。
そこで以下のような方法で行ってみたところエラーが出てしまいました。 改善点を教えて頂きたいです。 よろしくお願い致します。
binariA=imbinarize(A(:,1:end/2),ave*2)+ imbinarize(A(:,end/2:end),ave);
左半分の閾値を右半分の閾値の2倍にしてみました。
2 Comments
Accepted Answer
Akira Agata
on 22 Jan 2021
以下のような処理になるかと思いますが、いかがでしょう?
% グレースケール画像を準備
I = imread('cameraman.tif');
% 幅の半分、閾値1、閾値2を準備
wHalf = round(size(I,2)/2);
th1 = uint8(50);
th2 = uint8(150);
% 左半分と右半分を異なる閾値で2値化
BW = [I(:,1:wHalf)>th1, I(:,wHalf+1:end)>th2];
% 確認
figure
imshowpair(I,BW,'montage')
More Answers (0)
See Also
Categories
Find more on イメージ タイプの変換 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!