Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. int
  2. motion_count(Mat I) {
  3.  
  4. const int size = motion_mask_size;
  5. resize(I, I, Size(size, size), 0, 0, INTER_NEAREST);
  6.  
  7. int i = 0;
  8.  
  9. int count = 0;
  10.  
  11. for (
  12. MatConstIterator_<uchar>
  13.  
  14. it = I.begin<uchar>(),
  15. end = I.end<uchar>();
  16.  
  17. it != end;
  18. it++
  19. ) {
  20.  
  21. const bool b = *it == 0 ? false : true;
  22.  
  23. if (b) {
  24. count++;
  25. }
  26. }
  27.  
  28. return count;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement