Pengujian Mengatur Tempat Penyimpanan Gambar Sampel Pengujian Mengatur Kamera dan Port Arduino
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
Berdasarkan pseudecode deteksi petak tahap 2 pada Gambar 4.4, maka berikut ini adalah flowchart deteksi petak tahap 2 pada Gambar 4.5.
Gambar 4.5 FlowChart Deteksi Petak Tahap 2
Berdasarkan flowchart deteksi petak tahap 2 pada Gambar 4.5, maka berikut ini adalah flowgraph deteksi petak tahap 2 pada Gambar 4.6.
Gambar 4.6 FlowGraph Deteksi Petak Tahap 2
Berdasarkan flowgraph deteksi petak pada Gambar 4.6, maka berikut ini adalah cyclomatic complexity
E jumlah busur = 3 N jumlah simpul = 3
VG = E – N + 2 VG = 3 – 3 + 2
VG = 2 Setelah cyclomatic complexity diketahui nilainya yaitu 2, maka dapat
dihitung independent path sebagai berikut : Path 1 = 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 Path 2 = 1 – 2 – 3 – 4 – 5 – 6 – 7 – 8 – 9 – 10 – 11 – 12 – 13 – 14 – 15 – 16 – 17 –
18 – 19 – 20 – 21 – 22 – 23 – 24 – 30