import cv2
import numpy as np
# Load the image using OpenCV
image_cv = cv2.imread(image_path)
# Get the dimensions of the image
height, width, _ = image_cv.shape
# Split the image into two halves (left and right)
left_half = image_cv[:, :width//2]
right_half = image_cv[:, width//2:]
# Resize both halves to have the same height
new_width = min(left_half.shape[1], right_half.shape[1])
left_half_resized = cv2.resize(left_half, (new_width, height))
right_half_resized = cv2.resize(right_half, (new_width, height))
# Merge the two images smoothly
merged_image = np.hstack((left_half_resized, right_half_resized))
# Save the merged image
merged_image_path = "/mnt/data/merged_image.jpg"
cv2.imwrite(merged_image_path, merged_image)
# Return the path of the merged image
merged_image_path