0

in my case i want to join this two images 1st input image 2nd input image to get one image

after I detect aruco code (id and the 4 corners)of each image and I get the difference between the same aruco code i can merge image with this code when i found a repeated aruco id in next input

from PIL import Image

# Load the images
img1 = Image.open('./image/left.png')
img2 = Image.open('./image/right.png')




# Create a new blank image with the size of the largest image
image1_size = img1.size
image2_size = img2.size
new_image = Image.new('RGB',(2*image1_size[0], image1_size[1]), (250,250,250))
new_image.paste(img1,(0,0))
new_image.paste(img2,(image1_size[0],0))

# Save the merged image
new_image.save('merged_image.jpg')

I get this output my output but as an output I expect this result expected output

  • If you want this done automatically, you are looking more for *"stitching"* than pasting, see https://pyimagesearch.com/2016/01/11/opencv-panorama-stitching/ If you want simple pasting without shape transformations, you'd need to pass the coordinates to your second `paste()` call. – Mark Setchell Feb 24 '23 at 14:29

0 Answers0