2020-08-20 02:05:34 +02:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.iou = void 0;
|
|
|
|
function iou(box1, box2, isIOU = true) {
|
2020-08-18 14:04:33 +02:00
|
|
|
const width = Math.max(0.0, Math.min(box1.right, box2.right) - Math.max(box1.left, box2.left));
|
|
|
|
const height = Math.max(0.0, Math.min(box1.bottom, box2.bottom) - Math.max(box1.top, box2.top));
|
|
|
|
const interSection = width * height;
|
|
|
|
return isIOU
|
|
|
|
? interSection / (box1.area + box2.area - interSection)
|
|
|
|
: interSection / Math.min(box1.area, box2.area);
|
|
|
|
}
|
2020-08-20 02:05:34 +02:00
|
|
|
exports.iou = iou;
|
2020-08-18 14:04:33 +02:00
|
|
|
//# sourceMappingURL=iou.js.map
|