Classes | |
struct | fast_morpho_inner |
struct | fast_morpho_inner< Dim, Dim, I, S, H, B, P, O > |
struct | stat_ |
Min and Max on a structuring element. More... | |
struct | stat_< I, E, ntg::bin > |
struct | watershed_seg_point_handler_ |
struct | watershed_con_point_handler_ |
Functions | |
template<class E1, class E2, class E3> void | find_struct_elts (const abstract::struct_elt< E1 > &se, E2 se_add[mlc::exact< E1 >::ret::dim], E3 se_rem[mlc::exact< E1 >::ret::dim]) |
Find structuring elements. | |
template<class I, class E1, class E2, class H> void | hist_update (utils::abstract::histogram< H > &hist, const abstract::non_vectorial_image< I > &input, const typename mlc::exact< I >::ret::point_type &p, const abstract::struct_elt< E1 > &se_rem, const abstract::struct_elt< E2 > &se_add) |
Update an histogram. | |
template<class Point, class T> bool | watershed_seg_sort_ (const std::pair< Point, T > &p1, const std::pair< Point, T > &p2) |
Check if the second element of p1 is lower than the second one of p2. | |
template<class PointHandler, class DestValue, class I, class N> mute< I, DestValue >::ret | soille_watershed_ (const abstract::non_vectorial_image< I > &im_i, const abstract::neighborhood< N > &Ng) |
Algorithm by Vincent and Soille. |
|
Find structuring elements. Find structuring elements to be added/removed from the histogram when we move forward along each direction.
Definition at line 58 of file fast_morpho.hxx.
00061 { 00062 mlc_is_a(E2, abstract::struct_elt)::ensure(); 00063 mlc_is_a(E3, abstract::struct_elt)::ensure(); 00064 const unsigned dim = E1::dim; 00065 00066 // back[n] allows to move backward on coordinate `n'. 00067 oln_dpoint_type(E1) back[dim]; 00068 for (unsigned n = 0; n < dim; ++n) 00069 back[n].nth(n) = -1; 00070 00071 oln_iter_type(E1) dp(se); 00072 oln_iter_type(E1) dp_prime(se); 00073 00074 for_all(dp) 00075 { 00076 bool add[dim]; // whether to add `dp' when moving forward 00077 // on coordinate `n'. 00078 bool rem[dim]; // whether to remove `dp'. 00079 for (unsigned n = 0; n < dim; ++n) 00080 add[n] = rem[n] = true; 00081 00082 for_all(dp_prime) 00083 for (unsigned n = 0; n < dim; ++n) 00084 { 00085 if (dp_prime.cur() + back[n] == dp) 00086 // DP_PRIME is already in SE: don't add it. 00087 add[n] = false; 00088 00089 if (dp.cur() + back[n] == dp_prime) 00090 // DP is still in SE: don't remove it. 00091 rem[n] = false; 00092 } 00093 00094 for (unsigned n = 0; n < dim; ++n) 00095 { 00096 if (add[n]) 00097 { 00098 se_add[n].add(dp); 00099 } 00100 if (rem[n]) 00101 { 00102 se_rem[n].add(dp.cur() + back[n]); 00103 } 00104 } 00105 } 00106 00107 for (unsigned n = 0; n < dim; ++n) 00108 postcondition(se_add[n].card() == se_rem[n].card()); 00109 } |
|
Update an histogram. Update HIST by adding elements from _SE_ADD, and removing those from _SE_REM. Definition at line 120 of file fast_morpho.hxx. Referenced by oln::morpho::internal::fast_morpho_inner< NP1, Dim, I, S, H, B, P, O >::doit().
00125 { 00126 { 00127 oln_iter_type(E1) dp(se_rem); 00128 for_all(dp) 00129 --hist[input[p + dp]]; 00130 } 00131 { 00132 oln_iter_type(E2) dp(se_add); 00133 for_all(dp) 00134 ++hist[input[p + dp]]; 00135 } 00136 } |