Polygons <-> image with a given ofset and reslution

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Polygons <-> image with a given ofset and reslution

Johan Doré

Dear Boost Geometry,

 

We are happy users of boost::geometry for a broad range of our image analysis algorithms.

 

In our work we often need to draw polygons in byte** images with a given offset and resolution, as well as to convert from image object back to polygons.

 

When work with polygons their x,y coordinates are in millimeters and when we draw these polygons in an image we try to fill all pixels with a spatial center inside the polygon, and leave pixels with centers outside the polygon blank.

 

When converting from image objects (Collection of neighboring pixels with the same value) to polygons, we do it by tracing the outer border of such objects.

An example could be a 3x3 pixels image with the center pixels set to 1. If that image has its origin at 0,0 and the resolution is 1x1 pixel/millimeter. Then the closed clockwise polygon would become

{-0.5, 0.5}, {0.5, 0.5}, {0.5, -0.5}, {-0.5, -0.5}, {-0.5, 0.5}.

 

Now our functionality for drawing these polygons in images and our functionality for tracing the outline is far from optimal, and I wonder if you know of any boost functionality we could use instead?

 

Thanks in advance

 

Johan Doré,

Visiopharm

 


_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Polygons <-> image with a given ofset and reslution

Barend
Hi Johan,


Op 3 dec. 2014 om 22:34 heeft Johan Doré <[hidden email]> het volgende geschreven:

Dear Boost Geometry,

 

We are happy users of boost::geometry for a broad range of our image analysis algorithms.

 


Good to hear.



In our work we often need to draw polygons in byte** images with a given offset and resolution, as well as to convert from image object back to polygons.

 

When work with polygons their x,y coordinates are in millimeters and when we draw these polygons in an image we try to fill all pixels with a spatial center inside the polygon, and leave pixels with centers outside the polygon blank.

 

When converting from image objects (Collection of neighboring pixels with the same value) to polygons, we do it by tracing the outer border of such objects.

An example could be a 3x3 pixels image with the center pixels set to 1. If that image has its origin at 0,0 and the resolution is 1x1 pixel/millimeter. Then the closed clockwise polygon would become

{-0.5, 0.5}, {0.5, 0.5}, {0.5, -0.5}, {-0.5, -0.5}, {-0.5, 0.5}.

 

Now our functionality for drawing these polygons in images and our functionality for tracing the outline is far from optimal, and I wonder if you know of any boost functionality we could use instead?



Try to buffer all pixel centers with the half pixelsize as buffer-distance, and the square point buffer strategy. It should create a connecting polygon.


Regards, Barend


_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Loading...