How to extract a Roipoly area in an image with poly2mask function under my own defined coordinates
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kai Liu
el 25 de Jun. de 2022
Comentada: Kai Liu
el 26 de Jun. de 2022
I am working on an application to convert a 2D image into 3D space, I need to divide the image into different areas and extract the pixel values and pixel koordinates of each area, I have defined my own coordinate system for the subsequent conversion. The starting point of the x and y axes are at the center of the picture Now I know the coordinates of the four vertices of the quadrilateral
When I use poly2mask function I get the area at the default coordinates, which not consistent with my own defined coordinates. So I would ask, how can I get the enclosed area with poly2mask function? Thanks in advance.
0 comentarios
Respuesta aceptada
Image Analyst
el 25 de Jun. de 2022
poly2mask expects x and y to be in pixels. drawpolygon will give you the coordinates in pixels and thus should be fine for use immediately and directly in poly2mask.
If you have some other mapping and you want to use that in poly2mask then you'll have to map back to pixels to get the polygon on the image. For example if you used drawpolygon and got x and y, then you converted those into your special coordinate system, you'll have to unconvert them back to pixels, or else just use the original pixel coordinates that you got from drawpolygon.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!