[SciPy-user] circumference in raster image

Robert Cimrman cimrman3@ntc.zcu...
Wed Jul 8 10:53:40 CDT 2009


Zachary Pincus wrote:
>>>> Attached is find_contours, an extension module that finds all  
>>>> contours
>>>> in a 2D array at a specified iso-value. The contour position is  
>>>> linearly
>>>> interpolated between pixels. Let me know if you have any  
>>>> questions, etc.
>>>> (Looking over the code, I'm surprised how well I documented and
>>>> commented it... lucky break for anyone who wants to use or modify  
>>>> it, I
>>>> guess.) It's GPL because it comes from a larger GPL'd project of  
>>>> mine,
>>>> but just ask me and I'll send it under a different license.
>>> Thank you very much, I will try your code. This is the way I  
>>> thought I
>>> might try (interpolating by a smooth function/polynomial), so it's  
>>> cool
>>> I do not have to dive into it :-)
>> ok, I have tried find_contours() - it seems very suitable for my  
>> purposes!
> 
> Note of course that if the image starts out as binary, the exact same  
> problems that Gary described will apply: the contour segments will all  
> point in one of eight directions...

It does starts out as binary, so its the best I can get, IMHO. Anyway, 
it is going to be better than my gradient based approach. I will post 
here the results soon (soon in rc's time = next week).

> If the image originates as non-binary on the other hand, and instead  
> of thresholding at value X, you find the iso-contours at value X, you  
> might be able to get better values.

Maybe some decent blurring by ndimage filters would help, but I guess 
that the accuracy is going to be ok without that.

> Probably worth doing some ground-truth testing with mockup images. I'd  
> be interested in the results.

Basically, all my images are mockup (and binary), I can, however, 
increase their resolution at will, as they correspond to slices of 
objects with an analytical description. I will do some accuracy tests.

r.


More information about the SciPy-user mailing list