Merge branch 'main' of https://huggingface.co/spaces/DeclK/pose into main
Browse files
app.py
CHANGED
|
@@ -12,16 +12,16 @@ import cv2
|
|
| 12 |
import gradio as gr
|
| 13 |
|
| 14 |
def concat(img1, img2, height=1080):
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
# Calculate the scaling factor for each image
|
| 19 |
-
scale1 = height / img1.shape[
|
| 20 |
-
scale2 = height / img2.shape[
|
| 21 |
|
| 22 |
# Resize the images
|
| 23 |
-
img1 = cv2.resize(img1, (int(
|
| 24 |
-
img2 = cv2.resize(img2, (int(
|
| 25 |
|
| 26 |
# Concatenate the images horizontally
|
| 27 |
image = cv2.hconcat([img1, img2])
|
|
|
|
| 12 |
import gradio as gr
|
| 13 |
|
| 14 |
def concat(img1, img2, height=1080):
|
| 15 |
+
h1, w1, _ = img1.shape
|
| 16 |
+
h2, w2, _ = img2.shape
|
| 17 |
|
| 18 |
# Calculate the scaling factor for each image
|
| 19 |
+
scale1 = height / img1.shape[0]
|
| 20 |
+
scale2 = height / img2.shape[0]
|
| 21 |
|
| 22 |
# Resize the images
|
| 23 |
+
img1 = cv2.resize(img1, (int(w1*scale1), int(h1*scale1)))
|
| 24 |
+
img2 = cv2.resize(img2, (int(w2*scale2), int(h2*scale2)))
|
| 25 |
|
| 26 |
# Concatenate the images horizontally
|
| 27 |
image = cv2.hconcat([img1, img2])
|
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])
|