0

I need to merge two images (one is jpg and other one is png) based on its coordinate values. I have obtained coordinate value of both images and resized based on the size. I found a relevant answer here ,but it deals with only one pair of coordinates. Paste an image to another image at two given co-ordinates with altered opacity using PIL or OpenCV in Python

I checked the other link How can I paste an image to another image by comparing its coordinate values using PIL or opencv in Python? but still image is getting distorted. Pillow based merge will be better because my second image is png and pillow deals with the transparency of png files better. Can anyone suggest a better answer which deals with multiple coordinate value comparison in each images and merge?

the image will be like this enter image description here

enter image description here

The points will be like this,

"keypoints":[ {

"score":0.91145658
"part":"leftshoulder"
"position":{"x":233.165434,"y":326.7643555}

},

{

"score":0.91145658
"part":"right shoulder"
"position":{"x":233.165434,"y":326.7643555}

} ]

First image left shoulder point should merge with second image left shoulder point. First image right shoulder point should merge with second image right shoulder point. It will be go like this according to the points. That is the expected outcome

  • Can you provide an example input with the desired outcome? – Reti43 Mar 21 '21 at 04:58
  • @Reti43 I just updated above question. – Antony Jacob Mar 21 '21 at 05:15
  • You might look at https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.PiecewiseAffineTransform – fmw42 Mar 21 '21 at 06:03
  • Use a triangle mesh and interpolate with barycentric coordinates. See https://en.wikipedia.org/wiki/Barycentric_coordinate_system – fmw42 Mar 21 '21 at 06:09
  • The examples all are using one image..or any polygons. Can it do with 2 images? iam new to python. it will be helpful if u show me some examples than docs – Antony Jacob Mar 21 '21 at 07:41

0 Answers0