how to add edges to nodes and how use minimum spanning tree

조회 수: 3 (최근 30일)
Raghu Rao
Raghu Rao 2017년 4월 2일
댓글: Raghu Rao 2017년 4월 3일
i want to apply minimum spanning to my code but it is asking graph as input
clc;
clear all;
close all;
X=imread('i2.jpg');
imfinfo('i2.jpg')
figure,imshow(X)
b = imresize(X,[100,100]);
si = size(b,1);
sj = size(b,2);
figure;imshow(b);
% Binarization
th = graythresh(b);
I = im2bw(b,th);
w = 5;
h = 5;
c=si/w;
r=sj/h;
kl=bwmorph(~I,'thin',inf);
figure,imshow(kl)
R(:,:)=kl(:,:);
I=1;
U1=w;
J=1;
U2=h;
E=1;
for i=1:r
for j=1:c
B(I:U1,J:U2)=R(I:U1,J:U2);
[x,y]=find(B==1);
CX=mean(x);
CY=mean(y);
CXX(E)=CX;
CYY(E)=CY;
T(I:U1,J:U2)=B(I:U1,J:U2);
J=J+w;
U2=U2+h;
E=E+1;
clear B x y
%CYY(isnan(CYY)) = [];
%CXX(isnan(CXX)) = [];
end
I=I+w;
U1=U1+h;
J=1;
U2=h;
end
%kl(isnan(kl(:,1)),:) = [];
imshow(R)
hold on
hold on
plot(CYY,CXX,'.c','Markersize',8)
hold off
r = imread('empty.jpg');
re = imresize(r,[100,100]);
figure,imshow(re)
hold on
hold on
p = plot(CYY,CXX,'k*','Markersize',8);
hold off
CXX(isnan(CXX)) = [0]
CYY(isnan(CYY)) = [0]
from this i am getting only nodes i want to connect all the nodes after connecting each nodes i want to apply MINIMUM spanning tree please give me some code for add edges to nodes and how to use minimum spanning tree,
thanks in advance
  댓글 수: 10
Raghu Rao
Raghu Rao 2017년 4월 3일
Am doing my project on extraction of graph from handwritten word image, In my code I am only getting nodes but I want to add edges nodes I do not know how to add the edges to nodes I need some code for adding edges to nodes, after adding nodes I want to apply minimum spanning tree.algorith to represent the image in graph
Raghu Rao
Raghu Rao 2017년 4월 3일
i want represent the hand written word in this form

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by