I have four coordinates in the image, and I am interested in taking this polygon from the image. I try to do it in the following manner:
Edit: I use the solution from the @kglr answer, unfortunately, it does not take the correct part of the image. The link to the image is: https://www.dropbox.com/s/w58sikz2jip2sbg/19725.tiff?dl=0
coords = {{1983.44`, 992.097`}, {2034.18`, 1009.01`}, {2027.91`,
1027.18`}, {1977.8`, 1009.01`}, {1983.44`, 992.097`}};
polygon = Graphics[{
EdgeForm[{Thick, Black}],
FaceForm[], Polygon@coords
},
ImagePadding -> 0,
PlotRangePadding -> 0,
ImageMargins -> 0
];
mask = Graphics[
Polygon@coords,
ImageSize -> ImageDimensions[img],
AspectRatio -> Automatic
];