[SciPy-User] Points with given distance to a polygon

Zachary Pincus zachary.pincus@yale....
Mon Jul 26 14:41:48 CDT 2010


Oh cool! Shapely looks really useful -- thanks.


On Jul 26, 2010, at 3:28 PM, Joe Kington wrote:

> On Mon, Jul 26, 2010 at 1:26 PM, Zachary Pincus <zachary.pincus@yale.edu 
> > wrote:
> > I am working on a project where I am defining some regions of
> > interest.
> > I have a 2200x2200 px 2D Array in which my ROI is defined by a
> > polygon.
> > However, my data are smoothed by a gaussian kernel of width 300px,
> > and I
> > would like to draw some lines indicating this inner 150px distance  
> to
> > the borders of the ROI. I cannot come up with any way to do this,  
> does
> > anyone have an idea?
>
> Two broad options spring to mind:
> (1) Geometric -- shrink the polygon along the normals to the vertices.
> [Oh, I see that eat has given pseudocode for same... good]
> (2) Gridded -- rasterize the polygon to a binary mask (no tools for
> this in scipy, I fear... but if you're handy with opengl or something,
> that's not too hard), and then use scipy.ndimage to erode or dilate
> the mask as necessary.
>
> Zach
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
> If you go with a purely geometric method, look into a module like  
> shapely to buffer the polygon. (similar to the code snipped eat  
> posted, but more flexible)
>
> See this example for a general idea.
>
> -Joe
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list