How to extract a Roipoly area in an image with poly2mask function under my own defined coordinates
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kai Liu
am 25 Jun. 2022
Kommentiert: Kai Liu
am 26 Jun. 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 Kommentare
Akzeptierte Antwort
Image Analyst
am 25 Jun. 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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!