-
Notifications
You must be signed in to change notification settings - Fork 1
/
final_algorithm.txt
36 lines (24 loc) · 1.4 KB
/
final_algorithm.txt
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
algorithm 1: convertUMLSketchToCode(image, height_of_image, width_of_image)
Inputs:
1. image - An RGB image
2. height_of_image: Height of the RGB image
3. width_of_image: Width of the RGB image
Outputs:
1. codeSkeleton - returns a code skeleton of the UML class diagram
1. Pass the input image to YOLO_SE1 and obtain the bounding boxes.
2. Pass the resulting bounding boxes to the NMS thresholding algorithm to remove overlapping boxes.
3. Obtain a new image, img_1, by masking the bounding boxes from the original image. Store the center points of those boxes.
4. Group the lines in img_1 using contours.
5. Find the endpoints of each line group.
6. For each endpoint in the line segment group, find the nearest class.
7. Classify the line group as follows:
i. If the line has more than two endpoints and at least one endpoint associated with an inheritance symbol,
then it is an 'inheritance' line segment.
ii. If the line has only two end points, then it is an 'association' line segment.
iii. In any other case, classify it as an error.
8. Initialize the codeSkeleton.
9. For each class in the UML class diagram:
i. Initialize class base code.
ii. Add all the classes inherited by it.
iii. Add all the associations as attributes.
Return codeSkeleton