Spaces:
Sleeping
Sleeping
x, y coordinates computed for 640X640 image
Browse files- extractor.py +11 -4
extractor.py
CHANGED
@@ -56,10 +56,17 @@ def get_card_xy(model_path, image_path):
|
|
56 |
else:
|
57 |
pass
|
58 |
|
59 |
-
x1 = int((x_center - width / 2) * image_width)
|
60 |
-
y1 = int((y_center - height / 2) * image_height)
|
61 |
-
x2 = int((x_center + width / 2) * image_width)
|
62 |
-
y2 = int((y_center + height / 2) * image_height)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
# draw.rectangle([x1, y1, x2, y2], outline="red", width=2)
|
65 |
# text = f"Class: {class_name}, Score: {final_score:.2f}"
|
|
|
56 |
else:
|
57 |
pass
|
58 |
|
59 |
+
# x1 = int((x_center - width / 2) * image_width)
|
60 |
+
# y1 = int((y_center - height / 2) * image_height)
|
61 |
+
# x2 = int((x_center + width / 2) * image_width)
|
62 |
+
# y2 = int((y_center + height / 2) * image_height)
|
63 |
+
|
64 |
+
output_image_width = 640
|
65 |
+
output_image_height = 640
|
66 |
+
x1 = int((x_center - width / 2) * output_image_width)
|
67 |
+
y1 = int((y_center - height / 2) * output_image_height)
|
68 |
+
x2 = int((x_center + width / 2) * output_image_width)
|
69 |
+
y2 = int((y_center + height / 2) * output_image_height)
|
70 |
|
71 |
# draw.rectangle([x1, y1, x2, y2], outline="red", width=2)
|
72 |
# text = f"Class: {class_name}, Score: {final_score:.2f}"
|