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_LAP_HH
00027 # define MLN_LINEAR_LAP_HH
00028
00034 # include <mln/linear/convolve.hh>
00035 # include <mln/make/w_window2d.hh>
00036
00037
00038
00039 namespace mln
00040 {
00041
00042 namespace linear
00043 {
00044
00045
00046
00047 template <typename I>
00048 mln_ch_convolve(I, int)
00049 lap_4(const Image<I>& input);
00050
00051 template <typename I>
00052 mln_ch_convolve(I, int)
00053 lap_8(const Image<I>& input);
00054
00055 template <typename I>
00056 mln_ch_convolve(I, int)
00057 lap_x(const Image<I>& input);
00058
00059 template <typename I>
00060 mln_ch_convolve(I, int)
00061 lap_o(const Image<I>& input);
00062
00063
00064 # ifndef MLN_INCLUDE_ONLY
00065
00066
00067
00068 template <typename I>
00069 inline
00070 mln_ch_convolve(I, int)
00071 lap_4(const Image<I>& input)
00072 {
00073 trace::entering("linear::lap_4");
00074 mln_precondition(exact(input).is_valid());
00075 int ws[] = { 0, 1, 0,
00076 1, -4, 1,
00077 0, 1, 0 };
00078 mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00079 trace::exiting("linear::lap_4");
00080 return output;
00081 }
00082
00083 template <typename I>
00084 inline
00085 mln_ch_convolve(I, int)
00086 lap_8(const Image<I>& input)
00087 {
00088 trace::entering("linear::lap_8");
00089 mln_precondition(exact(input).is_valid());
00090 int ws[] = { 1, 1, 1,
00091 1, -8, 1,
00092 1, 1, 1 };
00093 mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00094 trace::exiting("linear::lap_8");
00095 return output;
00096 }
00097
00098 template <typename I>
00099 inline
00100 mln_ch_convolve(I, int)
00101 lap_x(const Image<I>& input)
00102 {
00103 trace::entering("linear::lap_x");
00104 mln_precondition(exact(input).is_valid());
00105 int ws[] = { +2, -1, +2,
00106 -1, -4, -1,
00107 +2, -1, +2 };
00108 mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00109 trace::exiting("linear::lap_x");
00110 return output;
00111 }
00112
00113 template <typename I>
00114 inline
00115 mln_ch_convolve(I, int)
00116 lap_o(const Image<I>& input)
00117 {
00118 trace::entering("linear::lap_o");
00119 mln_precondition(exact(input).is_valid());
00120 int ws[] = { -1, +2, -1,
00121 +2, -4, +2,
00122 -1, +2, -1 };
00123 mln_ch_convolve(I, int) output = convolve(input, make::w_window2d(ws));
00124 trace::exiting("linear::lap_o");
00125 return output;
00126 }
00127
00128 # endif // ! MLN_INCLUDE_ONLY
00129
00130 }
00131
00132 }
00133
00134
00135 #endif // ! MLN_LINEAR_LAP_HH