フィルターのクリア

how to build a graph from a skeleton

24 ビュー (過去 30 日間)
Dibanda Annick
Dibanda Annick 2019 年 5 月 17 日
回答済み: George Abrahams 2024 年 1 月 2 日
i got a 2D skeleton from a binary vessel map after applying thinning. Now i would like to build an undirected graph from this skeleton with nodes and edges linked together.
  2 件のコメント
Abir AFFANE
Abir AFFANE 2020 年 5 月 10 日
Kamya H
Kamya H 2021 年 7 月 7 日
Hey! I'm facing the same problem! Did you manage to find any answers/code to this question? tried skel2graph-3d too, but I'm getting quite a lot of errors!

サインインしてコメントする。

回答 (2 件)

Mike Wharton
Mike Wharton 2023 年 10 月 18 日
編集済み: Mike Wharton 2023 年 10 月 18 日
There is a blog post which explains what to do https://blogs.mathworks.com/steve/2015/12/14/image-based-graphs/
I think it is essentially something like this:
g = binaryImageGraph(bw);
figure
plotImageGraph(g)
This should work with a skeletonised binary image.

George Abrahams
George Abrahams 2024 年 1 月 2 日
Another method, using my bwgraph function from File Exchange.
% Load binary vessel map and skeletonize.
img = imread( "binaryVesselMap.png" );
img = bwskel( img );
% Construct an undirected graph from the skeletonized image.
G = bwgraph( img );
% For visual clarity and to save RAM, delete isolated nodes (those with no
% edges).
G = rmnode( G, find( ~img ) );
% Plot the graph, mimicking the layout of the source image.
[ Y, X ] = ind2sub( size( img ), find( img ) );
h = plot( G, 'XData', X(:), 'YData', Y(:), 'NodeLabel', [] );
axis tight equal
set( gca, 'YDir','reverse' )
% As an example application, use graph algorithms to find and highlight the
% longest branch of the graph. Distances are quasi-Euclidean.
d = distances( G );
d( isinf( d ) ) = -Inf;
[ ~, I ] = max( d(:) );
[ row, col ] = ind2sub( size( d ), I );
P = shortestpath( G, row, col );
highlight( h, P, 'NodeColor', 'r' )

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by