MCPcopy Create free account
hub / github.com/davisking/dlib / get_histogram

Function get_histogram

dlib/image_transforms/equalize_histogram.h:23–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 typename MM
22 >
23 void get_histogram (
24 const in_image_type& in_img_,
25 matrix<unsigned long,R,C,MM>& hist,
26 size_t hist_size
27 )
28 {
29 typedef typename image_traits<in_image_type>::pixel_type pixel_type;
30 COMPILE_TIME_ASSERT( pixel_traits<pixel_type>::is_unsigned == true );
31
32 // make sure hist is the right size
33 if (R == 1)
34 hist.set_size(1,hist_size);
35 else
36 hist.set_size(hist_size,1);
37
38
39 set_all_elements(hist,0);
40
41 const_image_view<in_image_type> in_img(in_img_);
42 // compute the histogram
43 for (long r = 0; r < in_img.nr(); ++r)
44 {
45 for (long c = 0; c < in_img.nc(); ++c)
46 {
47 auto p = get_pixel_intensity(in_img[r][c]);
48 if (p < hist_size)
49 ++hist(p);
50 }
51 }
52 }
53
54// ----------------------------------------------------------------------------------------
55

Callers 5

py_get_histogramFunction · 0.85
simple_partition_pixelsFunction · 0.85
equalize_histogramFunction · 0.85
partition_pixelsFunction · 0.85
auto_threshold_imageFunction · 0.85

Calls 6

set_all_elementsFunction · 0.85
get_pixel_intensityFunction · 0.85
maxFunction · 0.50
set_sizeMethod · 0.45
nrMethod · 0.45
ncMethod · 0.45

Tested by 1

simple_partition_pixelsFunction · 0.68