Challenge - Instagram Style Photo Collage

I have used open cv2 to combine the images horizontally and vertically using below function provided by open cv :

##for horizontal = hconcat()

##for verticle = vconcat()

the challenge that I face here is while combining the images with these functions images required to have the same dimensions.

Could you please suggest me some another way using which I can combine images of different dimensions too.

another thing is to make border I have used copyMakeBorder().

##Border code :

image1= cv2.copyMakeBorder(resized1, 10, 10, 10, 0, cv2.BORDER_CONSTANT)

image2= cv2.copyMakeBorder(resized2, 10, 10, 10, 10, cv2.BORDER_CONSTANT)

image3= cv2.copyMakeBorder(resized3, 10, 10, 10, 10, cv2.BORDER_CONSTANT)

image4= cv2.copyMakeBorder(resized4, 10, 0, 10, 0, cv2.BORDER_CONSTANT)

which makes code complex.

Screenshot of images with border: https://drive.google.com/file/d/1AmFpJlgegPzu82pEgtbioPZnYaHLTaca/view?usp=sharing

After that, I am able to merge the 4 images together with the border but not sure how to add the 5th image in the middle.

Screenshot of merged images: https://drive.google.com/file/d/1kI24OmzQkkiHqYwrRLTlKEtxUdm81pkX/view?usp=sharing

##Please provide me with a solution for this.

##Thank you

Hey @vi20083389, its a leader board challenge, we can’t provide you with solution, you need to somehow complete the assignment task your self. What i can do, is to help you little with the approach.

Hope you have all images with you loaded and are of size 200,200,3 and center image as size of (100,100,3).

Now further approach like this,
ans = np.zeros((430,430,3)), ( zero stands for black colour, so we have made black canvas by this time)
ans[10:210, 10:210] = top_left[:,:]
Add three lines for the rest 3 images.

Now comes the turn of center image, for this again you have to make two things, make the black canvas again, now the size of this canvas will be 120,120,3.
So first you need to use slicing to add black canvas and than you need to add the center image. Use pen and paper to get the slicing indices.

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.