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

Function mean_pixel

dlib/test/pyramid_down.cpp:95–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94template <typename image_type>
95rgb_pixel mean_pixel (
96 const image_type& img,
97 const rectangle& rect
98)
99{
100 long red = 0;
101 long green = 0;
102 long blue = 0;
103 for (long r = rect.top(); r <= rect.bottom(); ++r)
104 {
105 for (long c = rect.left(); c <= rect.right(); ++c)
106 {
107 red += img[r][c].red;
108 green += img[r][c].green;
109 blue += img[r][c].blue;
110 }
111 }
112
113 const long n = rect.area();
114 return rgb_pixel(red/n, green/n, blue/n);
115}
116
117// ----------------------------------------------------------------------------
118

Callers 1

test_pyramid_down_rgb2Function · 0.85

Calls 6

rgb_pixelClass · 0.85
topMethod · 0.45
bottomMethod · 0.45
leftMethod · 0.45
rightMethod · 0.45
areaMethod · 0.45

Tested by

no test coverage detected