00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_BINARIZATION_THRESHOLD_HH
00027 # define MLN_BINARIZATION_THRESHOLD_HH
00028 
00032 
00033 # include <mln/binarization/binarization.hh>
00034 # include <mln/fun/v2b/threshold.hh>
00035 
00036 
00037 namespace mln
00038 {
00039 
00040   namespace binarization
00041   {
00042 
00051     template <typename I>
00052     mln_ch_value(I, bool)
00053     threshold(const Image<I>& input, const mln_value(I) threshold);
00054 
00055 
00056 # ifndef MLN_INCLUDE_ONLY
00057 
00058     template <typename I>
00059     inline
00060     mln_ch_value(I, bool)
00061     threshold(const Image<I>& input, const mln_value(I) threshold_value)
00062     {
00063       trace::entering("binarization::threshold");
00064 
00065       mln_precondition(exact(input).is_valid());
00066       mlc_is(mln_trait_value_nature(mln_value(I)),
00067              trait::value::nature::scalar)::check();
00068 
00069       mln_ch_value(I, bool) output(exact(input).domain());
00070 
00071       
00072       fun::v2b::threshold< mln_value(I) > f(threshold_value);
00073 
00074       output = mln::binarization::binarization(exact(input), f);
00075 
00076       trace::exiting("binarization::threshold");
00077       return output;
00078     }
00079 
00080 # endif // ! MLN_INCLUDE_ONLY
00081 
00082   } 
00083 
00084 } 
00085 
00086 
00087 #endif // ! MLN_BINARIZATION_THRESHOLD_HH