二値化した画像を重ね合わせ等高線図みたいにしたい
Mostrar comentarios más antiguos
ある画像をそれぞれのしきい値(例:250、240、230・・・というような)で二値化処理し、
それぞれのしきい値で二値化した画像の白い領域の部分の色を変え(例:250の時赤、240の時青・・・といった感じ)
最後に色変えしたそれぞれのしきい値の二値化画像を重ね合わせて等高線図みたいな物を作りたいのですが
どなたかご教授お願いいたします。(下記のプログラムを改造または回答者様なりの方法でも構いません)
clear all;
close all;
% 各種定義
fig = 0;
for i=7
%Image Read
Imgfilename = strcat('./',num2str(i),'.jpg');
img=imread(Imgfilename);
gimg=rgb2gray(img);
BW = 250:5:255;
BW2 = medfilt2(BW);
BW3 = imfill(BW2,'holes');
BW4 = im2uint8(BW3);
BW_out = BW;
% Remove portions of the image that touch an outside edge.
BW_out = imclearborder(BW_out);
% Fill holes in regions.
BW_out = imfill(BW_out, 'holes');
% Filter image based on image properties.
BW_out = bwpropfilt(BW_out, 'Area', [10 + eps(10), Inf]);
% Get properties.
properties = regionprops(BW_out, {'Area'});
[~,num] = bwlabel(BW_out)
RGB(~cat(3,BW_out,BW_out,BW_out))=0;
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Marine and Underwater Vehicles en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!