-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOOD.puml
125 lines (108 loc) · 3.15 KB
/
OOD.puml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
@startuml
'https://plantuml.com/class-diagram
class Image{
# BufferedImage imageBuffer
# Pixel[][] greyscalePixels
# final String imagePath
+ Image(String imagePath)
+ String getImagePath()
+ BufferedImage getImageBuffer()
+ Pixel[][] getGrayscalePixels()
+ void bufferedImageToGrayscalePixels(IRgbToGrayscaleFunc rgbToGrayscaleFunc)
}
class HoledImage extends Image{
- final String maskPath
- final IRgbToGrayscaleFunc rgb2GrayFunc
- final Hole hole
+ HoledImage(String imagePath, String maskPath, int cType, IRgbToGrayscaleFunc rgb2GrayFunc)
+ Hole getHole()
- void carveOutTheHole()
- void findHole()
- void findBoundary()
}
class Hole{
- final Set<Pixel> pixels
- final Set<Pixel> boundary
- int final connectedType
+ Hole(int cType)
+ Set<Pixel> getPixels()
+ Set<Pixel> getBoundary()
+ void addToPixels(Pixel p)
+ void addToBoundary(Pixel p)
+ IWeightFunc getWeightFunc()
+ int getConnectedType()
+ boolean isHole(Pixel p)
+ boolean isBoundary(Pixel p)
}
class Pixel{
# int x
# int y
# float val
+ Pixel(int y, int x, int val)
+ int getY()
+ int getX()
+ float getVal()
+ void setVal(float val)
+ int hashCode()
+ boolean equals(Object obj)
}
class DirectedPixel extends Pixel{
- Direction direction
+ DirectedPixel(int x, int y, float val)
+ DirectedPixel(DirectedPixel refDirectedPixel)
+ Direction getDirection()
+ void setX(int x)
+ void setY(int y)
+ void rotateRight()
+ void rotateLeft()
+ boolean equals(Object obj)
}
enum Direction{
+ 0 UP : int
+ 1 RIGHT : int
+ 2 DOWN : int
+ 3 LEFT : int
- Direction(int v)
- final int value
+ Direction getDirectionByValue(int v)
+ Direction rotateRight()
+ Direction rotateLeft()
}
class HoleFillingLib{
+ {static} void fillHole(HoledImage image, IWeightFunc weightFunc, boolean isOptimized)
- {static} float calcColor(Pixel h, Set<Pixel> B, IWeightFunc w)
- {static} Set<Pixel> calcBAverageColors(int sections, List<Pixel> B)
}
class SquareTracing{
+ {static} List<Pixel> getBoundary(HoledImage srcImage)
- {static} Set<String> createBoundaryByKeys(Set<Pixel> boundary)
- {static} DirectedPixel getStartingPixel(HoledImage image)
- {static} void stepForward(DirectedPixel pixel)
- {static} void goLeft(DirectedPixel pixel)
- {static} void goRight(DirectedPixel pixel)
}
interface IWeightFunc{
+ float weight(Pixel p1, Pixel p2)
}
interface IRgbToGrayscaleFunc{
+ float rgbToGrayscale(Color c)
}
class MathCalculator{
+ {static} float euclideanDistance(Pixel p1, Pixel p2)
}
class IOImage{
+ {static} BufferedImage loadImageToBuffer(String imagePath)
+ {static} void save(String imagePath, Pixel[][] grayscalePixels)
}
class Consts{
+ {static} final double PIXEL_INTENSITY_VALUE
+ {static} final double HOLE_VALUE
+ {static} final int K
}
'Aggregation
Image "1" o-- "many" Pixel : aggregation >
HoledImage "1" o-- "1" Hole : aggregation >
'Composition
HoledImage "1" *-- "1" IRgbToGrayscaleFunc : composition >
Hole "1" *-- "many" Pixel : aggregation >
@enduml