Commit 166ff18c authored by Davis King's avatar Davis King

Made this code a little more efficient.

parent 2d086b45
...@@ -172,8 +172,7 @@ namespace dlib ...@@ -172,8 +172,7 @@ namespace dlib
{ {
const typename image_array_type::type& img = images[movable_rects[i].first]; const typename image_array_type::type& img = images[movable_rects[i].first];
assign_all_pixels(tempimg, 0); sum_filter_assign(img, tempimg, movable_rects[i].second);
sum_filter(img, tempimg, movable_rects[i].second);
const rectangle rect = get_rect(tempimg).intersect(translate_rect(window,position)); const rectangle rect = get_rect(tempimg).intersect(translate_rect(window,position));
if (rect.is_empty() == false) if (rect.is_empty() == false)
...@@ -352,8 +351,7 @@ namespace dlib ...@@ -352,8 +351,7 @@ namespace dlib
for (unsigned long i = 0; i < movable_rects.size(); ++i) for (unsigned long i = 0; i < movable_rects.size(); ++i)
{ {
const rectangle rect = movable_rects[i].second; const rectangle rect = movable_rects[i].second;
assign_all_pixels(temp, 0); sum_filter_assign(images[movable_rects[i].first], temp, rect);
sum_filter(images[movable_rects[i].first], temp, rect);
max_filter(temp, accum, window.width(), window.height(), 0); max_filter(temp, accum, window.width(), window.height(), 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment