11 Commits
Author SHA1 Message Date
aravind b3f055f698 Added brightness control node 2024-02-14 20:50:18 +05:30
Apple 7a154b1c48 new backpose 2024-02-07 16:17:44 +05:30
Apple 133cf8ad26 adding backpose kid 2024-02-07 13:45:12 +05:30
Apple e83f02ab3e adding backpose kid 2024-02-07 13:38:02 +05:30
Apple bbb45a0d1a front for neck ratio and positive prompt 2024-02-06 17:19:49 +05:30
Apple 4c1c313095 printing image angle and garment category 2024-02-06 16:54:32 +05:30
Apple bea92b2384 printing 2024-02-06 15:47:40 +05:30
Apple 6bbfaaf21a printing neck shoulder ratio 2024-02-06 12:27:40 +05:30
Apple 4fed1e9f94 printing neck shoulder ratio 2024-02-06 12:07:24 +05:30
Apple 4a693b703f v2.4 , neck-shoulder adjustment passing ratio 2024-02-06 11:54:39 +05:30
Ram Deshmukh 05c7d304da added new node for adjusting neck to standard ratio 2024-02-05 19:21:28 +05:30
4 changed files with 1573 additions and 399 deletions
+507 -366
View File
File diff suppressed because it is too large Load Diff
+14 -33
View File
@@ -35,7 +35,7 @@ def draw_bodypose(canvas: np.ndarray, keypoints: list) -> np.ndarray:
keypoint1 = keypoints[k1_index - 1]
keypoint2 = keypoints[k2_index - 1]
if any(i < 0 for i in keypoint1) or any(i < 0 for i in keypoint2):
if -1 in keypoint1 or -1 in keypoint2:
continue
Y = np.array([keypoint1[0], keypoint2[0]])
@@ -46,9 +46,8 @@ def draw_bodypose(canvas: np.ndarray, keypoints: list) -> np.ndarray:
angle = math.degrees(math.atan2(X[0] - X[1], Y[0] - Y[1]))
polygon = cv2.ellipse2Poly((int(mY), int(mX)), (int(length / 2), stickwidth), int(angle), 0, 360, 1)
cv2.fillConvexPoly(canvas, polygon, [int(float(c) * 0.6) for c in color])
for i, (keypoint, color) in enumerate(zip(keypoints, colors)):
if any(i < 0 for i in keypoint1):
if -1 in keypoint:
continue
x, y = keypoint[0], keypoint[1]
@@ -107,38 +106,25 @@ def rotate(src_keypoints, dest_keypoints, point1_idx, point2_idx):
return dest_keypoints
def scale(src_keypoints, dest_keypoints, ref_point1_idx, ref_point2_idx, point1_idx, point2_idx, ref_torso=False):
if ref_torso == True:
ref_x1,ref_y1 = src_keypoints[1]
ref_x3,ref_y3 = dest_keypoints[1]
ref_x2 = int((src_keypoints[8][0] + src_keypoints[11][0]) / 2)
ref_y2 = int((src_keypoints[8][1] + src_keypoints[11][1]) / 2)
ref_x4 = int((dest_keypoints[8][0] + dest_keypoints[11][0]) / 2)
ref_y4 = int((dest_keypoints[8][1] + dest_keypoints[11][1]) / 2)
else:
ref_x1,ref_y1 = src_keypoints[ref_point1_idx]
ref_x2,ref_y2 = src_keypoints[ref_point2_idx]
ref_x3,ref_y3 = dest_keypoints[ref_point1_idx]
ref_x4,ref_y4 = dest_keypoints[ref_point2_idx]
def scale(src_keypoints, dest_keypoints, ref_point1_idx, ref_point2_idx, point1_idx, point2_idx):
ref_x1,ref_y1 = src_keypoints[ref_point1_idx]
ref_x2,ref_y2 = src_keypoints[ref_point2_idx]
ref_x3,ref_y3 = dest_keypoints[ref_point1_idx]
ref_x4,ref_y4 = dest_keypoints[ref_point2_idx]
x1,y1 = src_keypoints[point1_idx]
x2,y2 = src_keypoints[point2_idx]
x3,y3 = dest_keypoints[point1_idx]
x4,y4 = dest_keypoints[point2_idx]
# src_ref_len = np.linalg.norm(np.array([ref_x1, ref_y1]) - np.array([ref_x2, ref_y2])) #src ref part distance
# dest_ref_len = np.linalg.norm(np.array([ref_x3, ref_y3]) - np.array([ref_x4, ref_y4])) #dest ref part distance
src_ref_len = np.linalg.norm(np.array([ref_x1, ref_y1]) - np.array([ref_x2, ref_y2])) #src ref part distance
dest_ref_len = np.linalg.norm(np.array([ref_x3, ref_y3]) - np.array([ref_x4, ref_y4])) #dest ref part distance
# src_targ_len = np.linalg.norm(np.array([x1, y1]) - np.array([x2, y2])) #src targ part distance
# dest_targ_len = np.linalg.norm(np.array([x3, y3]) - np.array([x4,y4])) #dest targ part distance
src_targ_len = np.linalg.norm(np.array([x1, y1]) - np.array([x2, y2])) #src targ part distance
dest_targ_len = np.linalg.norm(np.array([x3, y3]) - np.array([x4,y4])) #dest targ part distance
# src_targ_ref_ratio = src_targ_len / src_ref_len #src targ to ref ratio
# dest_targ_ref_ratio = dest_targ_len / dest_ref_len #dest targ to ref ratio
src_targ_ref_ratio = get_ratio(ref_x1, ref_y1, ref_x2, ref_y2, x1, y1, x2, y2) #src targ to ref ratio
dest_targ_ref_ratio = get_ratio(ref_x3, ref_y3, ref_x4, ref_y4, x3, y3, x4, y4) #dest targ to ref ratio
src_targ_ref_ratio = src_targ_len / src_ref_len #src targ to ref ratio
dest_targ_ref_ratio = dest_targ_len / dest_ref_len #dest targ to ref ratio
scale = src_targ_ref_ratio / dest_targ_ref_ratio
@@ -149,11 +135,6 @@ def scale(src_keypoints, dest_keypoints, ref_point1_idx, ref_point2_idx, point1_
return dest_keypoints
def get_ratio(ref_x1, ref_y1, ref_x2, ref_y2, x1, y1, x2, y2):
ref_len = np.linalg.norm(np.array([ref_x1, ref_y1]) - np.array([ref_x2, ref_y2])) #ref body part length
targ_len = np.linalg.norm(np.array([x1, y1]) - np.array([x2, y2])) #targ body part length
return targ_len / ref_len
def scale_hand(src_keypoints, dest_keypoints, ref_point1_idx, ref_point2_idx, starting_idx):
"""
@@ -258,7 +239,7 @@ def get_torso_angles(keypoints):
a,b = keypoints[5],keypoints[1]
angle_radians = math.tan((a[1]-b[1])/(a[0]-b[0]))
rs_angle = abs(math.degrees(angle_radians))
#getting bisector of torso and getting angle with y_axis
a,b,c = keypoints[8], keypoints[1], keypoints[11]
+526
View File
@@ -0,0 +1,526 @@
{
"height": 512,
"width": 512,
"keypoints": [
[
-1,
-1
],
[
252,
130
],
[
302,
130
],
[
316,
213
],
[
323,
284
],
[
202,
130
],
[
191,
211
],
[
187,
282
],
[
282,
278
],
[
280,
380
],
[
280,
484
],
[
222,
278
],
[
226,
382
],
[
222,
480
],
[
-1,
-1
],
[
-1,
-1
],
[
286,
72
],
[
227,
73
],
[
257,
59
],
[
257,
63
],
[
257,
65
],
[
253,
67
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
279,
79
],
[
-2,
-2
],
[
243,
67
],
[
253,
71
],
[
257,
69
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
275,
61
],
[
279,
59
],
[
255,
55
],
[
-2,
-2
],
[
-2,
-2
],
[
255,
59
],
[
255,
59
],
[
255,
59
],
[
255,
57
],
[
255,
57
],
[
255,
59
],
[
255,
59
],
[
255,
61
],
[
255,
63
],
[
277,
67
],
[
275,
67
],
[
277,
67
],
[
277,
67
],
[
277,
67
],
[
255,
59
],
[
255,
57
],
[
257,
59
],
[
257,
61
],
[
257,
59
],
[
255,
59
],
[
255,
59
],
[
257,
59
],
[
257,
59
],
[
-2,
-2
],
[
255,
59
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
279,
71
],
[
243,
67
],
[
279,
73
],
[
277,
71
],
[
279,
71
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
-2,
-2
],
[
279,
69
],
[
279,
71
],
[
277,
71
],
[
279,
71
],
[
277,
69
],
[
-2,
-2
],
[
250,
56
],
[
263,
63
],
[
186.65255255416977,
285
],
[
196.65255255416977,
291
],
[
199.65255255416977,
298
],
[
201.65255255416977,
306
],
[
201.65255255416977,
310
],
[
194.65255255416977,
308
],
[
196.65255255416977,
312
],
[
199.65255255416977,
316
],
[
203.65255255416977,
318
],
[
190.65255255416977,
308
],
[
192.65255255416977,
314
],
[
194.65255255416977,
318
],
[
201.65255255416977,
320
],
[
186.65255255416977,
308
],
[
186.65255255416977,
314
],
[
190.65255255416977,
318
],
[
196.65255255416977,
320
],
[
182.65255255416977,
308
],
[
184.65255255416977,
312
],
[
186.65255255416977,
316
],
[
190.65255255416977,
318
],
[
323,
287
],
[
313,
298
],
[
310,
305
],
[
310,
312
],
[
310,
317
],
[
320,
315
],
[
317,
319
],
[
313,
324
],
[
308,
326
],
[
322,
315
],
[
320,
322
],
[
315,
326
],
[
308,
326
],
[
324,
317
],
[
320,
322
],
[
315,
326
],
[
310,
326
],
[
327,
317
],
[
324,
322
],
[
320,
324
],
[
315,
326
]
]
}
+526
View File
@@ -0,0 +1,526 @@
{
"height": 512,
"width": 512,
"keypoints": [
[
-1,
-1
],
[
254,
118
],
[
292,
118
],
[
306,
194
],
[
310,
262
],
[
216,
118
],
[
200,
193
],
[
195,
260
],
[
278,
251
],
[
286,
357
],
[
285.99326159010275,
462.45102588957826
],
[
228,
254
],
[
230,
353
],
[
231.99326159010275,
458.45102588957826
],
[
-1,
-1
],
[
-1,
-1
],
[
277,
62
],
[
241,
62
],
[
234,
53
],
[
234,
60
],
[
234,
64
],
[
236,
71
],
[
236,
75
],
[
241,
77
],
[
243,
82
],
[
247,
84
],
[
254,
84
],
[
258,
84
],
[
263,
84
],
[
267,
82
],
[
272,
80
],
[
274,
75
],
[
276,
71
],
[
278,
66
],
[
281,
62
],
[
243,
44
],
[
245,
42
],
[
247,
42
],
[
252,
42
],
[
256,
42
],
[
265,
44
],
[
269,
44
],
[
272,
46
],
[
276,
49
],
[
278,
51
],
[
261,
51
],
[
258,
53
],
[
258,
55
],
[
258,
55
],
[
254,
62
],
[
254,
62
],
[
258,
62
],
[
261,
62
],
[
263,
62
],
[
245,
49
],
[
247,
49
],
[
252,
49
],
[
254,
49
],
[
249,
51
],
[
247,
49
],
[
265,
51
],
[
269,
51
],
[
272,
51
],
[
274,
55
],
[
272,
55
],
[
267,
53
],
[
247,
69
],
[
252,
66
],
[
254,
66
],
[
256,
66
],
[
258,
66
],
[
263,
69
],
[
265,
71
],
[
263,
73
],
[
258,
73
],
[
256,
73
],
[
252,
73
],
[
249,
71
],
[
247,
69
],
[
252,
66
],
[
256,
66
],
[
261,
69
],
[
265,
71
],
[
261,
73
],
[
256,
71
],
[
252,
71
],
[
249,
49
],
[
269,
51
],
[
195,
262
],
[
206,
270
],
[
210,
276
],
[
213,
280
],
[
216,
285
],
[
201,
287
],
[
208,
294
],
[
213,
296
],
[
216,
299
],
[
197,
289
],
[
206,
296
],
[
208,
299
],
[
213,
299
],
[
195,
289
],
[
201,
294
],
[
208,
296
],
[
208,
299
],
[
195,
289
],
[
197,
294
],
[
201,
296
],
[
206,
296
],
[
310,
265
],
[
304,
270
],
[
302,
274
],
[
299,
279
],
[
297,
284
],
[
308,
287
],
[
307,
292
],
[
304,
299
],
[
299,
301
],
[
309,
287
],
[
308,
292
],
[
307,
299
],
[
303,
301
],
[
310,
287
],
[
309,
292
],
[
308,
298
],
[
307,
302
],
[
313,
287
],
[
310,
291
],
[
309,
296
],
[
308,
299
]
]
}