26 #ifndef MLN_HISTO_EQUALIZATION_HH
27 # define MLN_HISTO_EQUALIZATION_HH
29 # include <mln/core/concept/image.hh>
30 # include <mln/histo/all.hh>
51 # ifndef MLN_INCLUDE_ONLY
57 trace::entering(
"histo::equalize");
59 const I& input = exact(input_);
60 mln_concrete(I) out_image;
65 unsigned cumulation = 0;
66 int number_of_pixels = input.nsites();
69 int max_color = mln_max(mln_value(I));
70 mln_piter(I) p(input.domain());
74 if (histogram(v) != 0)
76 cumulation += histogram(v);
77 histogram_correction(v) = (max_color)
78 * cumulation / number_of_pixels;
83 out_image(p) = histogram_correction[input(p)];
85 trace::exiting(
"histo::equalize");
89 # endif // ! MLN_INCLUDE_ONLY
97 #endif // ! MLN_HISTO_EQUALIZATION_HH