I am using the “MobileNetSSD_deploy.caffemodel” model to detect objects.
When it detects a person what I do is save it with “cv2.imwrite()”.
for (objectId, bbox) in objects.items():
x1, y1, x2, y2 = bbox
x1 = int(x1)
y1 = int(y1)
x2 = int(x2)
y2 = int(y2)
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
text = f"ID: {objectId}"
cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
auxFrame = frame.copy()
persona = auxFrame[y1:y2,x1:x2]
cv2.imwrite(f'reid_assets/gallery/{objectId}.jpg',persona)
My problem is that it saves the edges:
It’s honestly not a serious problem, but, I think it would be cleaner if the edges don’t come out. I can remove the rectangle, but for testing it is necessary. What solution do you suggest?