fix concat bug
Browse files
main.py
CHANGED
@@ -18,16 +18,16 @@ def parse_args():
|
|
18 |
return parser.parse_args()
|
19 |
|
20 |
def concat(img1, img2, height=1080):
|
21 |
-
|
22 |
-
|
23 |
|
24 |
# Calculate the scaling factor for each image
|
25 |
-
scale1 = height / img1.shape[
|
26 |
-
scale2 = height / img2.shape[
|
27 |
|
28 |
# Resize the images
|
29 |
-
img1 = cv2.resize(img1, (int(
|
30 |
-
img2 = cv2.resize(img2, (int(
|
31 |
|
32 |
# Concatenate the images horizontally
|
33 |
image = cv2.hconcat([img1, img2])
|
|
|
18 |
return parser.parse_args()
|
19 |
|
20 |
def concat(img1, img2, height=1080):
|
21 |
+
h1, w1, _ = img1.shape
|
22 |
+
h2, w2, _ = img2.shape
|
23 |
|
24 |
# Calculate the scaling factor for each image
|
25 |
+
scale1 = height / img1.shape[0]
|
26 |
+
scale2 = height / img2.shape[0]
|
27 |
|
28 |
# Resize the images
|
29 |
+
img1 = cv2.resize(img1, (int(w1*scale1), int(h1*scale1)))
|
30 |
+
img2 = cv2.resize(img2, (int(w2*scale2), int(h2*scale2)))
|
31 |
|
32 |
# Concatenate the images horizontally
|
33 |
image = cv2.hconcat([img1, img2])
|