Skip to content

Commit

Permalink
Updated multiple_objects.py demo file (commented)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasvedpathak committed Aug 19, 2021
1 parent 60fb14b commit ba605ee
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions demo/multiple_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import bbox_visualizer as bbv
import cv2

img = cv2.imread('../images/source_multiple.jpg')
annotation = json.load(open('../images/source_multiple.json'))
img = cv2.imread("../images/source_multiple.jpg")
annotation = json.load(open("../images/source_multiple.json"))
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

labels = []
bboxes = []
for shape in annotation['shapes']:
labels.append(shape['label'])
mins = shape['points'][0]
maxs = shape['points'][1]
for shape in annotation["shapes"]:
labels.append(shape["label"])
mins = shape["points"][0]
maxs = shape["points"][1]
bboxes.append(mins + maxs)

img_with_boxes = bbv.draw_multiple_rectangles(img, bboxes)
Expand All @@ -22,3 +22,25 @@
img_with_T_labels = bbv.add_multiple_T_labels(img_with_boxes_2, labels, bboxes)

img_with_flags = bbv.draw_multiple_flags_with_labels(img, labels, bboxes)

# image_copy = img.copy()

# img_regular = bbv.draw_detections(image_copy, bboxes, labels)
# img_regular = cv2.resize(
# img_regular, None, fx=1 / 3, fy=1 / 3, interpolation=cv2.INTER_AREA
# )
# cv2.imshow("img_regular", img_regular)

# image_copy = img.copy()
# img_t = bbv.draw_detections(image_copy, bboxes, labels, labelling_method="t-style")
# img_t = cv2.resize(img_t, None, fx=1 / 3, fy=1 / 3, interpolation=cv2.INTER_AREA)
# cv2.imshow("img_t", img_t)

# image_copy = img.copy()
# img_flag = bbv.draw_detections(image_copy, bboxes, labels, labelling_method="flag")
# img_flag = cv2.resize(img_flag, None, fx=1 / 3, fy=1 / 3, interpolation=cv2.INTER_AREA)
# cv2.imshow("img_flag", img_flag)


# cv2.waitKey(0)
# cv2.destroyAllWindows()

0 comments on commit ba605ee

Please sign in to comment.