Borrar filtros
Borrar filtros

フェレ径(イメージ領域)の可視化

7 visualizaciones (últimos 30 días)
彩華 伊佐
彩華 伊佐 el 3 de Nov. de 2022
Comentada: 彩華 伊佐 el 4 de Nov. de 2022
二値化画像から取得したフェレ径について、どの部分を計算しているのか確認したいです。
二値化画像に重ね合わせる形で、フェレ径の線分を表示させる方法を教えていただきたいです。
コードは以下の通りです。
I = imread("image.jpg");
% 2値化
level = graythresh (I);
BW = imbinarize(I,level);
BW1 = imfill(BW,'holes'); % オブジェクトの塗り潰し
Label = bwlabel(BW1,4); % ラベリング処理
prop = regionprops(Label,'MaxferetProperties'); % フェレ径情報の取得

Respuesta aceptada

Kojiro Saito
Kojiro Saito el 4 de Nov. de 2022
bwferetのドキュメントが役立つと思います。
フェレ径を求めた後、imshowで画像を表示した後、imdistlinelineを使って線を重ね書きできます。
同じ画像ファイルがないので、ここではtoyobjects.pngを使った例を提示します。
imdistlineの場合:線と距離が表示されます
I = imread("toyobjects.png");
bw = imbinarize(I,'adaptive');
bw = bwareafilt(bw,4);
bw = imfill(bw,'holes');
prop = regionprops('table', bw,'MaxferetProperties'); % フェレ径情報の取得
feretMax = prop.MaxFeretCoordinates;
feretMaxDiameter = prop.MaxFeretDiameter;
% フェレ径の線分の表示 (imdistlineの場合)
imshow(I);
axis = gca;
for n = 1:height(feretMax)
xmin = [feretMax{n}(1,1) feretMax{n}(2,1)];
ymin = [feretMax{n}(1,2) feretMax{n}(2,2)];
imdistline(axis,xmin,ymin);
end
lineの場合:線のみ表示されます
I = imread("toyobjects.png");
bw = imbinarize(I,'adaptive');
bw = bwareafilt(bw,4);
bw = imfill(bw,'holes');
prop = regionprops('table', bw,'MaxferetProperties'); % フェレ径情報の取得
feretMax = prop.MaxFeretCoordinates;
feretMaxDiameter = prop.MaxFeretDiameter;
% フェレ径の線分の表示 (lineの場合)
imshow(I);
axis = gca;
for n = 1:height(feretMax)
xmin = [feretMax{n}(1,1) feretMax{n}(2,1)];
ymin = [feretMax{n}(1,2) feretMax{n}(2,2)];
line(axis, xmin, ymin)
end
  1 comentario
彩華 伊佐
彩華 伊佐 el 4 de Nov. de 2022
表示させることができました。ありがとうございます。

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre イメージ en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!