特定の範囲における二値化について(初心者です)
28 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
二値化において、imbinarizeを用いているのですが、 イメージAの左半分の閾値を右半分の閾値よりも高く設定して二値化したいです。
そこで以下のような方法で行ってみたところエラーが出てしまいました。 改善点を教えて頂きたいです。 よろしくお願い致します。
binariA=imbinarize(A(:,1:end/2),ave*2)+ imbinarize(A(:,end/2:end),ave);
左半分の閾値を右半分の閾値の2倍にしてみました。
2 Kommentare
Akzeptierte Antwort
Akira Agata
am 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')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu イメージ タイプの変換 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!