Bonjour, je suis sur un projet en codant sous Matlab et j'ai un petit soucis. Je suis arrive a obtenir un squelette satisfaisant de mon image et mon but est de rechercher le chemin minimum entre les points pour optimiser le squelette
Voici le debut d'un code qu'on m'a propose dans lequel je n'arrive pas a déterminer a quoi correspondent les variables NumP et Result...
Quelqu'un a une idee?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 % minimum path between points Nodes = zeros(NumP,2); [Nodes(:,1),Nodes(:,2)] = find(Result ==1); TotalChemin = 0; for i=1:NumP-1 for j=i+1:NumP FirstPoint = Nodes(i,:); LastPoint = Nodes(j,:); if (norm(LastPoint-FirstPoint)<MaxiDist) % Search area for the minimum path SearchA = abs(LastPoint(1)-FirstPoint(1)) ; SearchB = abs(LastPoint(2)-FirstPoint(2)) ; Candidates = zeros(SearchA*SearchB,2); num = 0; if (FirstPoint(1)<LastPoint(1)) signA =1; else signA = (-1); end if (FirstPoint(2)<LastPoint(2)) signB =1; else signB = (-1); end for p=0:SearchA for q =0:SearchB num= num+1; Path(numero,1) = FirstPoint(1)+signX*p; Path(numero,2) = FirstPoint(2)+signY*q; end end
Partager