Pengujian Kecepatan dan Test Koordinat Alat Bantu
Berdasarkan flowgraph deteksi petak tahap 1 pada Gambar 4.3, maka berikut ini adalah cyclomatic complexity deteksi petak tahap 1
E jumlah busur = 23 N jumlah simpul = 18
VG = E – N + 2 VG = 23 – 18 + 2
VG = 7 Setelah cyclomatic complexity diketahui nilainya yaitu 7, maka dapat
dihitung independent path sebagai berikut : Path 1 = 1 – 2 – 3 – 4 – 5 – 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 – 43
Path 2 = 1 – 2 – 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 – 43 Path 3 =1 – 2 – 3 – 4 – 5 – 10 – 11 – 37 – 43
Path 4 = 1 – 2 – 3 – 4 – 5 – 10 – 11 – 12 – 13 – 14 – 15 – 16 – 17 – 18 – 22 – 23 – 24 – 25 – 26 – 27 – 28 – 29 – 30 – 31 – 32 – 33 – 34 – 35 – 36 – 37 – 43
Path 5 = 1 – 2 – 3 – 4 – 5 – 10 – 11 – 12 – 13 – 14 – 15 – 16 – 17 – 18 – 19 – 20 – 21 – 22 – 23 – 24 – 25 – 29 – 30 – 31 – 32 – 33 – 34 – 35 – 36 – 37 – 43
Path 6 = 1 – 2 – 3 – 4 – 5 – 10 – 11 – 12 – 13 – 14 – 15 – 16 – 17 – 18 – 19 – 20 – 21 – 22 – 23 – 24 – 25 – 26 – 27 – 28 – 29 – 30 – 35 – 36 – 37 – 43
Path 7 = 1 – 2 – 3 – 4 – 5 – 10 – 11 – 38 – 39 – 40 – 41 – 42 – 43 Graph Matrixnya adalah sebagai Tabel 4.15 berikut:
Tabel 4.15 Graph Matrik Tahap 1
Node 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1
1 1
2 1
3 1
4 1
Node 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 5
1 1 1
6 1 1
7 1
8 1
9 1 10 1 1
11 1 12 1
13 1 1 14 1
15 1
16 1
17 1
18 1.
1-1 =1 2.
1-1 =0 3.
1-1 =0 4.
1-1 =0 5.
3-1 =2 6.
2-1 =1 7.
1-1 =0 8.
1-1 =0 9.
1-1 =0 10.
2-1 =1 11.
1-1 =0 12.
1-1 =0 13.
2-1 =1 14.
1-1 =0 15.
1-1 =0 16.
1-1 =0 Cyclomatic Complexity
dari Graph Matrix pada Tabel 4.15 adalah 6 + 1 = 7
1
Image Gray
, byte
imgSceneGray = null
;
2
Image Gray
, byte
imgToFindGray = null
;
3
VectorOfKeyPoint vkpSceneKeyPoints;
4
VectorOfKeyPoint vkpToFindKeyPoints;
5
Matrix Single
mtxSceneDescriptors;
6
Matrix Single
mtxToFindDescriptors;
7
Matrix int
mtxMatchIndices;
8
Matrix Single
mtxDistance;
9
Matrix byte
mtxMask;
10
HomographyMatrix homographyMatrix =
null ;
11
int intKNumNearestNeighbors = 2;
12
int intNumNonZeroElements;
13
Rectangle rectImageToFind =
new Rectangle
0, 0, 0, 0;
14
PointF [] ptfPointsf;
15
Point [] ptPoints;
16
imgSceneGray = ImgSceneColor.Convert Gray
, byte
;
17
imgToFindGray =
ImgToFindColor.Convert Gray
, byte
;
18
vkpSceneKeyPoints = surfdetector.DetectKeyPointsRawimgSceneGray,
null ;
19
mtxSceneDescriptors = surfdetector.ComputeDescriptorsRawimgSceneGray,
null ,
vkpSceneKeyPoints;
20
vkpToFindKeyPoints = surfdetector.DetectKeyPointsRawimgToFindGray,
null ;
21
mtxToFindDescriptors = surfdetector.ComputeDescriptorsRawimgToFindGray,
null ,
vkpToFindKeyPoints;
22
Emgu.CV.FLANN. Index
fln = new
Index mtxToFindDescriptors;
23
if mtxSceneDescriptors =
null
24
{
25
mtxMatchIndices =
new Matrix
int mtxSceneDescriptors.Rows,
intKNumNearestNeighbors;
26
mtxDistance =
new Matrix
Single mtxSceneDescriptors.Rows,
intKNumNearestNeighbors;
27
fln.KnnSearchmtxSceneDescriptors, mtxMatchIndices, mtxDistance, intKNumNearestNeighbors, 12;
28
mtxMask = new
Matrix byte
mtxDistance.Rows, 1;
29
mtxMask.SetValue255;
30
}
Gambar 4.4 Pseudecode Deteksi Petak Tahap 2