Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. for (int i = 0; i < src->rows; i++) {
  2. for (int j = 0; j < src->cols; j++) {
  3. if (src->at<Vec3b>(i, j) == src->at<Vec3b>(y, x)) {
  4. nom += (i - rb)*(j - cb);
  5. den += (j - cb)*(j - cb) - (i - rb)*(i - rb);
  6. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i - 1, j - 1)) { perimeter++; continue; }
  7. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i - 1, j)) { perimeter++; continue; }
  8. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i - 1, j + 1)) { perimeter++; continue; }
  9. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i, j - 1)) { perimeter++; continue; }
  10. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i, j + 1)) { perimeter++; continue; }
  11. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i + 1, j - 1)) { perimeter++; continue; }
  12. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i + 1, j)) { perimeter++; continue; }
  13. if (src->at<Vec3b>(i, j) != src->at<Vec3b>(i + 1, j + 1)) { perimeter++; continue; }
  14.  
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement