<div dir="ltr">Not that I'm aware of, but experienced users could direct you to it if there is one.<br><br><div>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.</div><div><br></div><div>a) Get the histogram of the image [1].</div><div>b) Convert the histogram to a 1D-image [2].</div><div>c) Find the local maxima [3] and perform the check.</div><div><br></div><div>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]. </div><div><br></div><div>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.</div><div><br></div><div>[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1Statistics_1_1ImageToHistogramFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1Statistics_1_1ImageToHistogramFilter.html</a></div><div>[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1HistogramToImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1HistogramToImageFilter.html</a><br></div><div>[3] <a href="http://www.itk.org/Doxygen/html/classitk_1_1RegionalMaximaImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1RegionalMaximaImageFilter.html</a></div><div>[4] <a href="http://public.kitware.com/pipermail/insight-users/2009-July/031433.html" target="_blank">http://public.kitware.com/pipermail/insight-users/2009-July/031433.html</a><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 25, 2014 at 9:37 AM, Zein Salah <span dir="ltr"><<a>zeinsalah@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">well. is there a ready-made filter /function to automatically check if<br>
the image has a bi-modal histogram?<br>
<div><div><br>
On Wed, Nov 12, 2014 at 2:14 PM, Girish Mallya Udupi<br>
<<a>indianzeppelin@gmail.com</a>> wrote:<br>
> Hi Zein,<br>
><br>
> As you might know, Otsu's method assumes that the histogram of the image is<br>
> bi-modal. i.e., there are two classes of pixels forming two peaks separated<br>
> by a valley.<br>
> All the method (and the corresponding ITK filter) does is calculate the<br>
> threshold which maximizes the inter-class variance and apply it on the<br>
> image.<br>
><br>
><br>
> On Wed, Nov 12, 2014 at 12:43 PM, Zein Salah <<a>zeinsalah@gmail.com</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I have been using the otsu filter for doing object-from-background<br>
>> separation. However, I noticed that the filter always comes out with an<br>
>> separation threshold, even if the image does NOT actually have a<br>
>> "reasonable" background, see the attached image, e.g..<br>
>><br>
>> My question is: is it possible to control the filter in such a way that it<br>
>> only generate a threshold if there is really a background?<br>
>><br>
>> Practically, I could, in a post-processing step,  do a decision weather<br>
>> the separation is feasible or not, e.g. computing the comparing the<br>
>> statistics of the two separated areas (average intensity, variance, etc.).<br>
>> But I thought the otsu filter already does such things internally, right? Is<br>
>> it possible to inquire such data from the filter?<br>
>><br>
>> Any ideas would be welcome!!<br>
>><br>
>> Much thanks,<br>
>><br>
>> Zein<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Community mailing list<br>
>> <a>Community@itk.org</a><br>
>> <a href="http://public.kitware.com/mailman/listinfo/community" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Regards,<br>
> Girish<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr">Regards,<br>Girish</div></div>
</div></div>