Created
February 28, 2016 07:04
-
-
Save ck196/91ccc4cb0ed7a99532ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def detect_and_save(self, input_path): | |
| img = cv2.imread(input_path) | |
| copy_img = img.copy() | |
| bboxes = self.detect(img) | |
| for bbox_cls in bboxes: | |
| for bbox, class_name in bbox_cls: | |
| cv2.rectangle(frameClone, (bbox[0], bbox[1]), (bbox[2], bbox[3]), (0, 255, 0), 2) | |
| cv2.putText(copy_img,class_name,(bbox[0],bbox[1] - 20), cv2.FONT_HERSHEY_PLAIN, 1.0, (0,0,255), 1) | |
| save_path = "data/" +str(hashlib.md5(img).hexdigest()) + ".jpg" | |
| cv2.imwrite(save_path,copy_img) | |
| return save_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment