-1 so ensure indexes are correct

This commit is contained in:
Nicolas Mowen 2022-09-20 17:49:39 -06:00 committed by GitHub
parent faf583451f
commit ae1899daf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -457,8 +457,8 @@ def detect(
size = region[2] - region[0] size = region[2] - region[0]
x_min = int(max(0, (box[1] * size) + region[0])) x_min = int(max(0, (box[1] * size) + region[0]))
y_min = int(max(0, (box[0] * size) + region[1])) y_min = int(max(0, (box[0] * size) + region[1]))
x_max = int(min(detect_config.width, (box[3] * size) + region[0])) x_max = int(min(detect_config.width - 1, (box[3] * size) + region[0]))
y_max = int(min(detect_config.height, (box[2] * size) + region[1])) y_max = int(min(detect_config.height - 1, (box[2] * size) + region[1]))
width = x_max - x_min width = x_max - x_min
height = y_max - y_min height = y_max - y_min
area = width * height area = width * height