[SciPy-user] circumference in raster image
Tue Jul 7 18:03:54 CDT 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,
Robert Cimrman wrote:
> 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?
More information about the SciPy-user