How Convert the 2D Binary Data to the Node-link Graph?

9 visualizaciones (últimos 30 días)
Changwoo Lee
Changwoo Lee el 22 de Jun. de 2023
Respondida: Gourab el 23 de Jun. de 2023
Hello, I have a 2D binary data as follows:
I = imread('threads.png');
Icomplement = imcomplement(I);
BW = imbinarize(Icomplement);
imshow(BW);
Then, I want to convert this 2D binary data to the Node-link Graph.
Finally, I want to detect where the disconnectivity of each link occurs.
Meanwhiles, I found the matlab code (skel2graph3D) on the link (https://kr.mathworks.com/matlabcentral/fileexchange/43527-skel2graph-3d)
However, this code might only support the conversion of 3D binary data to the node-link graph.
Therefore, my question is how to convert the 2D binary data to the node-link graph.
Is there any useful Matlab code library?
Your answers are of great help for me. Thank you very much.

Respuestas (1)

Gourab
Gourab el 23 de Jun. de 2023
Hi Changwoo,
After reading the question I get that you want to convert the 2D image to a node linked graph but you are unable to do it using "Skel2Graph3D” function.
You can use the “bwskel” function to convert the binary image BW to a skeleton and then using the “Skel2Graph3D” function plot it as a node-link graph.
Refer to the below code snippet.
% Read binary image
I = imread('threads.png');
% Invert image and binarize
BW = ~imbinarize(I);
% Compute skeleton using bwskel
skel = bwskel(BW);
% Convert skeleton to node-link graph
node_graph = Skel2Graph3D(skel,15);
% Plot node-link graph
figure;
h = plot(node_graph);
Refer to the below documentation links for more information.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by