-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
blobFromImage and crop #14659
Copy link
Copy link
Closed
Labels
Milestone
Description
in blobFromImage it is possible to resize and crop image. blob generated can be used as input for yolo net. Values return by yolo are in a new coordinates system that must be computed using this code :
if crop:
s = max([blob_width / img.shape[1], blob_height / img.shape[0]])
r_blob = (int(0.5 / s * (int(img.shape[1] * s) - blob_width )),
int(0.5 / s * (int(img.shape[0] * s) - blob_height )),
int(blob_width / s),
int(blob_height / s))
else:
r_blob = (0, 0, img.shape[1], img.shape[0])
for yolov3 or yolov2 result.
new function would be Rect getBlobFromimagerect(Mat , Size , bool crop)
Is it a good pr?
Reactions are currently unavailable