[ITK] Otsu Filter for object/background separation
Girish Mallya Udupi
indianzeppelin at gmail.com
Thu Nov 27 06:24:16 EST 2014
Not that I'm aware of, but experienced users could direct you to it if
there is one.
You could check the number of local maxima in the histogram, and run OTSU
only if there are two. To find the local maxima, try the following steps.
a) Get the histogram of the image [1].
b) Convert the histogram to a 1D-image [2].
c) Find the local maxima [3] and perform the check.
However, in practice, the histogram might be really noisy and might require
some smoothing before you find the local maxima (before step (c)). See [4].
A better way might be to find the maxima of the kernel density estimate of
the histogram, but I am not sure how to do this in ITK.
[1]
http://www.itk.org/Doxygen/html/classitk_1_1Statistics_1_1ImageToHistogramFilter.html
[2] http://www.itk.org/Doxygen/html/classitk_1_1HistogramToImageFilter.html
[3]
http://www.itk.org/Doxygen/html/classitk_1_1RegionalMaximaImageFilter.html
[4] http://public.kitware.com/pipermail/insight-users/2009-July/031433.html
On Tue, Nov 25, 2014 at 9:37 AM, Zein Salah <zeinsalah at gmail.com> wrote:
> well. is there a ready-made filter /function to automatically check if
> the image has a bi-modal histogram?
>
> On Wed, Nov 12, 2014 at 2:14 PM, Girish Mallya Udupi
> <indianzeppelin at gmail.com> wrote:
> > Hi Zein,
> >
> > As you might know, Otsu's method assumes that the histogram of the image
> is
> > bi-modal. i.e., there are two classes of pixels forming two peaks
> separated
> > by a valley.
> > All the method (and the corresponding ITK filter) does is calculate the
> > threshold which maximizes the inter-class variance and apply it on the
> > image.
> >
> >
> > On Wed, Nov 12, 2014 at 12:43 PM, Zein Salah <zeinsalah at gmail.com>
> wrote:
> >>
> >> Hello,
> >>
> >> I have been using the otsu filter for doing object-from-background
> >> separation. However, I noticed that the filter always comes out with an
> >> separation threshold, even if the image does NOT actually have a
> >> "reasonable" background, see the attached image, e.g..
> >>
> >> My question is: is it possible to control the filter in such a way that
> it
> >> only generate a threshold if there is really a background?
> >>
> >> Practically, I could, in a post-processing step, do a decision weather
> >> the separation is feasible or not, e.g. computing the comparing the
> >> statistics of the two separated areas (average intensity, variance,
> etc.).
> >> But I thought the otsu filter already does such things internally,
> right? Is
> >> it possible to inquire such data from the filter?
> >>
> >> Any ideas would be welcome!!
> >>
> >> Much thanks,
> >>
> >> Zein
> >>
> >>
> >> _______________________________________________
> >> Community mailing list
> >> Community at itk.org
> >> http://public.kitware.com/mailman/listinfo/community
> >>
> >
> >
> >
> > --
> > Regards,
> > Girish
>
--
Regards,
Girish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20141127/53e333f1/attachment.html>
More information about the Community
mailing list