I am not able to paste the 5th image over collage, i am not getting any method for that, how can i do that , please help.
Code link :- https://drive.google.com/file/d/1Lmsf-xDSXlM1RMyM5cvGtfLVy3LH4oLq/view?usp=sharing
How can i overlay the 5th image in between the collage
Hey @saksham_thukral, first of all you have to resize the center image to (100,100,3) and not (200,200,3). It’s a misprint in the question. Now after you have stacked up the images together using the np.hstack()
, you can calculate the total size of image right ? It would be (430,430,3). Now you simple have to find the range of pixels over which you have to place the center image. So in this case you can directly use something like this :
final_img[165:265,165:265] = center_image
This would place your center image on the whole final image. I hope this resolves your doubt
Happy Learning
Try doing what I have told :
final_img[165:265,165:265] = center_image
and then tell the output !
i did the same way as you said , i infact pasted the picture along, but for more clearance here i am attaching the link to the updated code:-
https://drive.google.com/file/d/1xezCtEhrZE1bTIs0pJh85GqeA13iwMXh/view?usp=sharing
Hey @saksham_thukral, can you please try running this :
final_img[155:275,155:275] = center_borders
This won’t give you the error ! As after padding we need a space of (120,120,3), that’s why !
I thought you were doing it without padding. Anyways now this should work definitely !
Happy Learning
It although worked, but can you please explain me why i was getting error for coordinates, [155:265,155,265] ?
That was giving error because the image that we are trying to overlay is of size (120,120,3) and [155:265, 155:265] just can overlay an image of (110,110,3) right ? So an image of size (120,120,3) ofcourse requires a space of [155:275,155:275] in the final image !
I hope this resolves your doubt !
Please mark the doubt as resolved in your doubts section !
Happy Learning