iou.js 581 B

12345678910111213
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. function iou(box1, box2, isIOU) {
  4. if (isIOU === void 0) { isIOU = true; }
  5. var width = Math.max(0.0, Math.min(box1.right, box2.right) - Math.max(box1.left, box2.left));
  6. var height = Math.max(0.0, Math.min(box1.bottom, box2.bottom) - Math.max(box1.top, box2.top));
  7. var interSection = width * height;
  8. return isIOU
  9. ? interSection / (box1.area + box2.area - interSection)
  10. : interSection / Math.min(box1.area, box2.area);
  11. }
  12. exports.iou = iou;
  13. //# sourceMappingURL=iou.js.map