简体   繁体   中英

Cut Image with different Coordinates non-rectangular

I want to cut a region in a picture with different coordinates.

I have points like that:

  <point x="720" y="549" />
  <point x="805" y="665" />
  <point x="715" y="698" />
  <point x="644" y="582" />

And I want to use them to get a new picture without a mask in the background or something like that. Only the Region from this coordinates. I have something like that: NumPy/OpenCV 2: how do I crop non-rectangular region? But I can not transform it, to my solution. Maybe someone of you can help me.

Thank you! Felix

Have you tried to do something like:

img = img.crop((150, 150, 230, 350))

Where the first 2 coordinates(x,y) are the top left corner and the 2 last coordinates(x,y) are bottom right corner of it.

Note the coordinates are given in pixels.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM