• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

log.hh

00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
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     // LoG_5x5  (Cf. Sonka et al., pages 85-86)
00064     // This is also a "mexican hat".
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     // LoG 7x7  (Cf. Russ, p. 250)
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     // LoG 13x13  (Cf. Russ, p. 250)
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     // LoG 17x17  (Cf. Sonka et al., pages 85-86)
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   } // end of namespace mln::linear
00165 
00166 } // end of namespace mln
00167 
00168 
00169 #endif // ! MLN_LINEAR_LOG_HH

Generated on Tue Oct 4 2011 15:24:03 for Milena (Olena) by  doxygen 1.7.1