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_LINEAR_LOG_HH
00027 # define MLN_LINEAR_LOG_HH
00028 
00032 
00033 # include <mln/linear/convolve.hh>
00034 # include <mln/make/w_window2d.hh>
00035 
00036 
00037 
00038 namespace mln
00039 {
00040 
00041   namespace linear
00042   {
00043 
00044     template <typename I>
00045     mln_ch_convolve(I, int)
00046     LoG_5x5(const Image<I>& input);
00047 
00048     template <typename I>
00049     mln_ch_convolve(I, int)
00050     LoG_7x7(const Image<I>& input);
00051 
00052     template <typename I>
00053     mln_ch_convolve(I, int)
00054     LoG_13x13(const Image<I>& input);
00055 
00056     template <typename I>
00057     mln_ch_convolve(I, int)
00058     LoG_17x17(const Image<I>& input);
00059 
00060 
00061 # ifndef MLN_INCLUDE_ONLY
00062 
00063     
00064     
00065 
00066     template <typename I>
00067     inline
00068     mln_ch_convolve(I, int)
00069     LoG_5x5(const Image<I>& input)
00070     {
00071       trace::entering("linear::LoG_5x5");
00072       mln_precondition(exact(input).is_valid());
00073       int ws[] = { +0,  0, -1,  0,  0,
00074                    +0, -1, -2, -1,  0,
00075                    -1, -2, 16, -2, -1,
00076                    +0, -1, -2, -1,  0,
00077                    +0,  0, -1,  0,  0 };
00078       mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00079       trace::exiting("linear::LoG_5x5");
00080       return output;
00081     }
00082 
00083     
00084 
00085     template <typename I>
00086     inline
00087     mln_ch_convolve(I, int)
00088     LoG_7x7(const Image<I>& input)
00089     {
00090       trace::entering("linear::LoG_7x7");
00091       mln_precondition(exact(input).is_valid());
00092       int ws[] = { +0,  0, -1, -1, -1,  0,  0, 
00093                    +0, -1, -3, -3, -3, -1,  0,
00094                    -1, -3,  0,  7,  0, -3, -1,
00095                    -1, -3,  7, 24,  7, -3, -1,
00096                    -1, -3,  0,  7,  0, -3, -1,
00097                    +0, -1, -3, -3, -3, -1,  0,
00098                    +0,  0, -1, -1, -1,  0,  0 };
00099       mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00100       trace::exiting("linear::LoG_7x7");
00101       return output;
00102     }
00103 
00104     
00105 
00106     template <typename I>
00107     inline
00108     mln_ch_convolve(I, int)
00109     LoG_13x13(const Image<I>& input)
00110     {
00111       trace::entering("linear::LoG_13x13");
00112       mln_precondition(exact(input).is_valid());
00113       int ws[] = { +0,  0,  0,  0,  0, -1, -1, -1,  0,  0,  0,  0,  0,
00114                    +0,  0,  0, -1, -1, -2, -2, -2, -1, -1,  0,  0,  0,
00115                    +0,  0, -2, -2, -3, -3, -4, -3, -3, -2, -2,  0,  0,
00116                    +0, -1, -2, -3, -3, -3, -2, -3, -3, -3, -2, -1,  0,
00117                    +0, -1, -3, -3, -1,  4,  6,  4, -1, -3, -3, -1,  0,
00118                    -1, -2, -3, -3,  4, 14, 19, 14,  4, -3, -3, -2, -1,
00119                    -1, -2, -4, -2,  6, 19, 24, 19,  6, -2, -4, -2, -1,
00120                    -1, -2, -3, -3,  4, 14, 19, 14,  4, -3, -3, -2, -1,
00121                    +0, -1, -3, -3, -1,  4,  6,  4, -1, -3, -3, -1,  0,
00122                    +0, -1, -2, -3, -3, -3, -2, -3, -3, -3, -2, -1,  0,
00123                    +0,  0, -2, -2, -3, -3, -4, -3, -3, -2, -2,  0,  0,
00124                    +0,  0,  0, -1, -1, -2, -2, -2, -1, -1,  0,  0,  0,
00125                    +0,  0,  0,  0,  0, -1, -1, -1,  0,  0,  0,  0,  0 };
00126       mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00127       return output;
00128     }
00129 
00130 
00131     
00132 
00133     template <typename I>
00134     inline
00135     mln_ch_convolve(I, int)
00136     LoG_17x17(const Image<I>& input)
00137     {
00138       trace::entering("linear::LoG_17x17");
00139       mln_precondition(exact(input).is_valid());
00140       int ws[] = { +0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0,
00141                    +0, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0,
00142                    +0, 0,-1,-1,-1,-2,-3,-3,-3,-3,-3,-2,-1,-1,-1, 0, 0,
00143                    +0, 0,-1,-1,-2,-3,-3,-3,-3,-3,-3,-3,-2,-1,-1, 0, 0,
00144                    +0,-1,-1,-2,-3,-3,-3,-2,-3,-2,-3,-3,-3,-2,-1,-1, 0,
00145                    +0,-1,-2,-3,-3,-3, 0, 2, 4, 2, 0,-3,-3,-3,-2,-1, 0,
00146                    -1,-1,-3,-3,-3, 0, 4,10,12,10, 4, 0,-3,-3,-3,-1,-1,
00147                    -1,-1,-3,-3,-2, 2,10,18,21,18,10, 2,-2,-3,-3,-1,-1,
00148                    -1,-1,-3,-3,-3, 4,12,21,24,21,12, 4,-3,-3,-3,-1,-1,
00149                    -1,-1,-3,-3,-2, 2,10,18,21,18,10, 2,-2,-3,-3,-1,-1,
00150                    -1,-1,-3,-3,-3, 0, 4,10,12,10, 4, 0,-3,-3,-3,-1,-1,
00151                    +0,-1,-2,-3,-3,-3, 0, 2, 4, 2, 0,-3,-3,-3,-2,-1, 0,
00152                    +0,-1,-1,-2,-3,-3,-3,-2,-3,-2,-3,-3,-3,-2,-1,-1, 0,
00153                    +0, 0,-1,-1,-2,-3,-3,-3,-3,-3,-3,-3,-2,-1,-1, 0, 0,
00154                    +0, 0,-1,-1,-1,-2,-3,-3,-3,-3,-3,-2,-1,-1,-1, 0, 0,
00155                    +0, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0,
00156                    +0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0 };
00157       mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00158       trace::exiting("linear::LoG_17x17");
00159       return output;
00160     }
00161 
00162 # endif // ! MLN_INCLUDE_ONLY
00163 
00164   } 
00165 
00166 } 
00167 
00168 
00169 #endif // ! MLN_LINEAR_LOG_HH