@@ -31,16 +31,17 @@ def get_mean_color(img, cell):
3131 b = int (b / ((cell [1 ]- cell [0 ])* (cell [3 ]- cell [2 ])))
3232 return (r ,g ,b )
3333
34- def put_stroke (img , position , color ):
35- xs = position [0 ]
36- xf = position [1 ]
37- ys = position [2 ]
38- yf = position [3 ]
39-
40- percent1 = 3
41- percent2 = 5
34+ def put_stroke (img , position_ori , color ):
35+ xs = position_ori [0 ] - int ((position_ori [0 ]/ 100 )* 2 )
36+ xf = position_ori [1 ] + int ((position_ori [0 ]/ 100 )* 2 )
37+ ys = position_ori [2 ] - int ((position_ori [0 ]/ 100 )* 2 )
38+ yf = position_ori [3 ] + int ((position_ori [0 ]/ 100 )* 2 )
39+ #print(f"position: ({xs}:{xf}, {ys}:{yf})")
40+
41+ #percent1 = 5
42+ #percent2 = 5
4243
43- if position [0 ] - int ((position [0 ]/ 100 )* percent1 ) > 0 :
44+ ''' if position[0] - int((position[0]/100)*percent1) > 0:
4445 xs = position[0] - int((position[0]/100)*percent1)
4546 else:
4647 if position[0] - int((position[0]/100)*percent2) > 0:
@@ -63,8 +64,8 @@ def put_stroke(img, position, color):
6364 else:
6465 if position[3] + int((position[3]/100)*percent2) < img.shape[1]:
6566 yf = position[3] + int((position[3]/100)*percent2)
66-
67-
67+ '''
68+ position = []
6869 position = [xs , xf , ys , yf ]
6970 x = (position [1 ]- position [0 ])
7071 y = (position [3 ]- position [2 ])
@@ -108,12 +109,14 @@ def get_4cell(cell):
108109 [sx + int (x / 2 ), fx , sy , sy + int (y / 2 )],
109110 [sx + int (x / 2 ), fx , sy + int (y / 2 ), fy ],
110111 ]
112+
113+ #print(cells[0])
111114 return cells
112115
113116
114117def get_random_brush ():
115118 brushes = [ "brushes/brush2.png" , "brushes/brush3.png" , "brushes/brush4.png" , "brushes/brush6.png" , "brushes/brush7.png" ]
116- #brushes = ["brushes/brush4.png", "brushes/brush6.png", "brushes/brush7.png"]
119+ #brushes = ["brushes/brush4.png", "brushes/brush6.png", "brushes/brush7.png", "brushes/brush3.png", "brushes/brush4.png", ]
117120 #brushes = ["brushes/brush2.png"]
118121 return random .choice (brushes )
119122
0 commit comments