How to extract a polygon from an image
Posted: 2014-03-26T09:44:35-07:00
I would like to use Magick++ or the imagemagick command line to extract
an n-gon from an image. The n-gon is specified by a list the
vertices. So, for example I would like to be able to extract an n-gon
defined by the points a,b,c,d,e,f,g,h which define a region that looks
like:
out of, for example, a png image. I assume I have to do some kind of
composite operation with an image mask, or if using Magick++ define a
DrawableClipPath. But, I can't find any documentation for this. Any
help would be appreciated.
p.s. My preference is to do this using C++ and Magick++ because I have other
processing to do, but am happy to do it with the commandline too.
an n-gon from an image. The n-gon is specified by a list the
vertices. So, for example I would like to be able to extract an n-gon
defined by the points a,b,c,d,e,f,g,h which define a region that looks
like:
Code: Select all
a---------h
| |
| g-f
| |
b---c |
| |
| |
| |
d-------e
composite operation with an image mask, or if using Magick++ define a
DrawableClipPath. But, I can't find any documentation for this. Any
help would be appreciated.
p.s. My preference is to do this using C++ and Magick++ because I have other
processing to do, but am happy to do it with the commandline too.