Advertisement
Guest User

integral-image

a guest
Apr 14th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. void integral2(int h, int w, uchar *src, uint *sum)
  2. {
  3.     uchar *pg;
  4.     uint *ps;
  5.     uint *psu;
  6.     uint s; // line sum
  7.  
  8.     for (int c = 0; c < n_bins; c++) {
  9.         pg = src + c * w * h;
  10.         ps = sum + n_bins * (w + 2) + c;
  11.         psu = sum + n_bins + c;
  12.  
  13.         for (int y = 1; y < h + 1; y++, ps += n_bins, psu += n_bins) {
  14.             s = 0;
  15.  
  16.             for (int x = 1; x < w + 1; x++, pg++, ps += n_bins, psu += n_bins) {
  17.                 s += *pg;
  18.                 *ps = *psu + s;
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement