[SciPy-user] circumference in raster image

Gary Ruben gruben at bigpond.net.au
Tue Jul 7 19:03:54 EDT 2009


I recently sat in on a lecture on how to do this. In summary, there is 
no best way to do it - it's an open research problem.
Search for "Best Line Unbiased Estimators" to find out more.
If you just walk around the discretised 8-connected circumference and 
try to compute pi from it, it will converge to 8(sqrt(2)-1), which is 
close to pi and comes from the sum of sides of an octagon enclosing the 
circle (this makes sense because all the traversals can be ordered to 
lie on this octagon), so you need to be smarter, unless that's an 
acceptable uncertainty for your problem.

Zach's suggestion to use find_contours is probably a good one, depending 
on how the contouring is done - certainly sounds like a promising approach,

Gary R.

Robert Cimrman wrote:
> Hi!
> 
> Hoping that there are some raster image experts around: I need to 
> compute an approximation of circumference of an object (with smooth 
> boundary) represented as a filled area in a 2d array. Can scipy.ndimage 
> deal with that?
> 
> thanks,
> r.




More information about the SciPy-User mailing list