1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
// Copyright (C) 2006 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_EQUALIZE_HISTOGRAm_ABSTRACT_
#ifdef DLIB_EQUALIZE_HISTOGRAm_ABSTRACT_
#include "../pixel.h"
#include "../matrix.h"
namespace dlib
{
// ---------------------------------------------------------------------------------------
template <
typename in_image_type,
typename out_image_type
>
void equalize_histogram (
const in_image_type& in_img,
out_image_type& out_img
);
/*!
requires
- in_image_type == is an implementation of array2d/array2d_kernel_abstract.h
- out_image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename in_image_type::type>::has_alpha == false
- pixel_traits<typename out_image_type::type>::has_alpha == false
- pixel_traits<typename in_image_type::type>::is_unsigned == true
- pixel_traits<typename out_image_type::type>::is_unsigned == true
- pixel_traits<typename in_image_type::type>::max() < std::numeric_limits<long>::max()
ensures
- #out_img == the histogram equalized version of in_img
- #out_img.nc() == in_img.nc()
- #out_img.nr() == in_img.nr()
!*/
template <
typename image_type
>
void equalize_histogram (
image_type& img
);
/*!
requires
- it is valid to call equalize_histogram(img,img)
ensures
- calls equalize_histogram(img,img);
!*/
// ---------------------------------------------------------------------------------------
template <
typename in_image_type,
long R,
long C,
typename MM
>
void get_histogram (
const in_image_type& in_img,
matrix<unsigned long,R,C,MM>& hist
);
/*!
requires
- in_image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename in_image_type::type>::is_unsigned == true
- pixel_traits<typename in_image_type::type>::max() < std::numeric_limits<long>::max()
- hist must be capable of representing a column vector of length
pixel_traits<typename in_image_type>::max(). I.e. if R and C are nonzero
then they must be values that don't conflict with the previous sentence.
ensures
- #hist.size() == pixel_traits<typename in_image_type>::max()
- #hist.nc() == 1 || #hist.nr() == 1 (i.e. hist is either a row or column vector)
- #hist == the histogram for in_img. I.e. it is the case that for all
valid i:
- hist(i) == the number of times a pixel with intensity i appears
in in_img
!*/
// ---------------------------------------------------------------------------------------
}
#endif // DLIB_EQUALIZE_HISTOGRAm_ABSTRACT_
|