[SciPy-User] Edge Detection
Dan Yamins
dyamins@gmail....
Thu Nov 12 12:23:33 CST 2009
On Thu, Nov 12, 2009 at 10:23 AM, Chris Colbert <sccolbert@gmail.com> wrote:
> All of the OpenCV edge detection routines are also available in
> scikits.image if you have opencv (>= 2.0) installed.
>
> On Tue, Nov 10, 2009 at 5:48 PM, Zachary Pincus <zachary.pincus@yale.edu>
> wrote:
>
> >
> > Code: Look at what's available in scipy.ndimage. There are functions for
> > getting gradient magnitudes, as well as standard filters like Sobel etc.
> > (which you'll learn about from the above), plus morphological operators
> for
> > modifying binarized image regions (e.g. like erosion etc.; useful for
> > getting rid of stray noise-induced edges), plus some basic functions for
> > image smoothing like median filters, etc.
> >
> > For exploratory analysis, you might want some ability to interactively
> > visualize images; you could use matplotlib or the imaging scikit, which
> is
> > still pre-release but making fast progress:
> > http://github.com/stefanv/scikits.image
> >
> > I've attached basic code for Canny edge detection, which should
> demonstrate
> > a bit about how ndimage works, plus it's useful in its own right. There
> is
> > also some code floating around for anisotropic diffusion and bilateral
> > filtering, which are two noise-reduction methods that can be better than
> > simple median filtering.
> >
>
Hi Chris and Zachary, thanks very much for your help. I really appreciate
it.
My goal was to recognize linear (and circular) strokes in images of text.
After I wrote my question and did some further research, I realized that I
was so ignorant that I didn't know enough to properly ask for what I
wanted. Finding strokes in letters is actually more like "line detection"
(as in "detecting lines as geometric features") than it is like edge
detection (e.g. something that the sobel operator does well). I needed to
localize the lines and describe them in some geometric way, not so much
determine where their boundaries were.
What I ended up doing is using the Radon transform (scipy.misc.radon),
together with the hcluster package. The basic idea is that applying Radon
transform to the image of a letter transforms the strokes into confined
blobs whose position and extent in the resulting point/angle space describes
the location, width, and angle of the original stroke. Then, I make a
binary version of the transformed image by applying an indicated threshold
on intensity -- e.g. a 1 at all points in the transformed image whose
intensity are above the threshold, and 0 elsewhere. Then, I cluster this
binary image, which ends up identifying clusters whose centroid and diameter
correspond to features of idealized strokes. This algorithm seems to
work pretty well.
Thanks alot again for your help, the scipy.ndimage package really seems
great. I read somewhere that the edge-detection routines will actually
become part of the next version of the package. Is that still true?
Thanks,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091112/e1fe465f/attachment.html
More information about the SciPy-User
mailing list