二次元画像の二値化について
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Tatsuto Okamura
 el 29 de Ag. de 2019
  
    
    
    
    
    Comentada: Tatsuto Okamura
 el 1 de Sept. de 2019
            二次元画像の二値化において、
『imbinarize』を使用しているのですが、特定の範囲を閾値2/255、それ以外を閾値20/255で二値化したいです。
良い方法はないでしょうか?
0 comentarios
Respuesta aceptada
  Shunichi Kusano
    
 el 29 de Ag. de 2019
        特定の範囲のマスク画像を作成した上で、下のような形で作成可能です。わかりやすくするために一つずつ作って、はめ込んでいますが、「2値化」セクションの3行を1行にくっつけていいと思います。
clear, clc, close all
img = imread('peppers.png');
band = img(:,:,3);
%% 仮のマスク
mask = zeros(size(band), 'logical');
mask(100:300,100:400) = true;
%% 2値化
bw1 = (band > 2) & mask; % mask==1の範囲の2値化
bw2 = (band > 20) & ~mask; % mask==0の範囲の2値化
bw = bw1 | bw2; % 2つの2値化画像をはめ込む
%% 確認
close all
figure, imshow(band, [])
figure, imshow(mask);
figure, imshow(bw1);
figure, imshow(bw2);
figure, imshow(bw);
Más respuestas (0)
Ver también
Categorías
				Más información sobre White en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
