• No se han encontrado resultados

Capitulo Diecisiete Un libro abierto

In document FALLEN Por Lauren Kate (página 196-200)

Recall from Chapter 4 that to extract the features from an image using a graph-based repre- sentation comprises five sub-processes: (i) quadtree decomposition, (ii) tree/graph representa- tion (using the Graph Modelling Language (GML) file representation), (iii) feature subgraph mining, (iv) feature vector generation and (v) feature selection (as described in further detail on Section 4.2 to Section 4.5 of Chapter 4). With respect to graph based image representation there are three algorithms that merit further discussed in this appendix: (i) Algorithm 7 for gen- erating the GML file format and (ii) Algorithm 8 for conducting the quadtree decomposition. To generate the GML file format (Algorithm 7), firstly a household image was decomposed using Algorithm 8 then a set of nodes and edges were generated before converted into a GML file format.

The algorithms used to generate the graph based image representation were implemented using MATLAB version 2014b [126]. The graph-based representation mechanism was used to

Algorithm 5Least Squares and Line Fitting for Horizontal Line

1: Input:

2: original= A satellite image

3: Lines= A collection of lines from Hough transform

4: Output:

5: hLines= A collection of horizontal lines

6: hLineTotal= Number of horizontal lines

7: minY = Minimumyvalue of horizontal lines

8: maxY= Maximumyvalue of horizontal lines

9: hLineTotal = 0 10: minY = original.height 11: maxY = 0 12: forj =0 to j = 1do 13: start = j*original.height/2 14: end = (j+1)*original.height/2 15: hLinesj.lineTotal = 0 16: hLinesj.min = original.width 17: hLinesj.max = 0 18: hLinesj.y = 0 19: yTotal = 0 20: fork = 0 to k = | lines | -1do

21: if linesk.type = horizontal and start <= linesk.start.x <= end and start <= linesk.end.x <= end then

22: hLinesj.lineTotal = hLinesj.lineTotal + 1

23: yTotal = yTotal + linesk.start.y + linesk.end.y

24: ifhLinesj.min > linesk.start.xthen 25: hLinesj.min = linesk.start.x

26: end if

27: if hLinesj.max < linesk.end.xthen 28: hLinesj.max = linesk.end.x 29: end if 30: end if 31: end for 32: ifhLinesj.lineTotal > 0then 33: hLinesj.y = yTotal/(hLinesj.lineTotal*2) 34: hLineTotal = hLineTotal + 1

35: ifhLinesj.y < minYthen 36: minY = hLinesj.y

37: end if

38: ifhLinesj.y > maxYthen 39: maxY = hLinesj.y

40: end if

41: end if

Algorithm 6Least Squares and Line Fitting for Vertical Line

1: Input:

2: Lines= A collection of lines from Hough transform

3: original= A satellite image

4: Output:

5: vLines= A collection of vertical lines

6: vLineTotal= Number of vertical lines

7: minX= Minimumxvalue of vertical lines

8: maxX = Maximumxvalue of vertical lines

9: vLineTotal = 0

10: minX = original.width

11: maxX = 0

12: forj =0 to j = 1do

13: start = j*original. width /2

14: end = (j+1)*original. width /2

15: vLinesj.lineTotal = 0 16: xTotal = 0 17: vLinesj.min = original.height 18: vLinesj.max = 0 19: vLinesj.x = 0 20: fork = 0 to k = | lines | -1do

21: iflinesk.type = vertical and start <= linesk.start.y <= end and start <= linesk.end.y <= end then

22: vLinesj.lineTotal = vLinesj.lineTotal + 1

23: xTotal = xTotal + linesk.start.x + linesk.end.x

24: ifvLinesj.min > linesk.start.ythen 25: vLinesj.min = linesk.start.y

26: end if

27: ifvLinesj.max < linesk.end.ythen 28: vLinesj.max = linesk.end.y 29: end if 30: end if 31: end for 32: ifvLinesj.lineTotal > 0then 33: vLinesj.x = xTotal/(vLinesj.lineTotal*2) 34: vLineTotal = vLineTotal + 1

35: ifvLinesj.x < minX then 36: minX = vLinesj.x

37: end if

38: ifvLinesj.x > maxXthen 39: maxX = vLinesj.x

40: end if

41: end if

Thus Frequent Subgraph Mining (FSM) was applied. FSM is the process of identifying fre- quently occurring subgraphs which were considered to be features. To facilitate the operation of the FSM process, the input graph was transformed into GML format, a format compatible with the adopted FSM process.

The GML file format was generated using Algorithm 7. The input to the algorithm is a collection of household images. The output is a collection of graphs represented using the GML file format,GmlFile. For each household, the image was decomposed using a quadtree decomposition using a call to Algorithm 8 (line 6). Once the household images have been decomposed and recored in the quadtree format, the nodes and edges were then identified. The loop from lines 7 to 10 was for nodes and node label identification for the leaf nodes (lines 6-7). The loop from lines 11 to 23 was for nodes and edges generation the remaining nodes. One each iteration (level), each child node was used to identified the parent node (line 13). If the parent node did not exist then this parent node and node label were generated and recored in theparentNodesarray (lines 14-18). The edge label from the child node to parent node was generated (line 19). The parent nodes were assigned to be the child nodes for next level (line 21) and the parent node array was set to empty (line 22).

Once a collection of node and edge labels were identified. The GML open and close tags were then included (lines 24-25). The GML file was then generated and saved for further usage in the context of the FSM process (lines 26-31).

The quadtree decomposition algorithm (Algorithm 8) takes as input a 2D household image and a maximum level of decomposition (a value of 4 in this case). The output of the algorithm was a quadtree whereby the whole image was represented by the root of the tree (line 5). The whole image (the root level) was then decomposed using the function quadDecomposition

(line 6). The function from line 7 to 17 is thequadDecompositionfunction which conducts the desired quadtree decomposition process. If the current level of decomposition is not zero the current (sub) image is decomposed into four quadrants or regions (line 11). The process continues in a recursive manner until homogenous regions are reached or the maximum level of decomposition is attained (line 12-17).

In document FALLEN Por Lauren Kate (página 196-200)