# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import json
import cv2
import matplotlib.pyplot as plt
# %matplotlib inline
plt.rcParams['figure.figsize'] = [20, 10]

with open('bboxes.json','r') as f:
    data = json.load(f)

keys = list(data.keys())

i=0
img = plt.imread(keys[i],-1)
plt.imshow(img)
img.shape

bboxes = data[keys[i]]

bboxes = list(map(lambda x: list(map(lambda y: float(y), x.strip().split(','))),bboxes))

for x,y,w,h in bboxes:
    ymin,xmin,ymax,xmax = int(y),int(x),int(y+h),int(x+w)
    img = cv2.rectangle(img,(xmin,ymin),(xmax,ymax),(0,255,0,255),2)

plt.imshow(img)

StarcoderdataJupyterScriptsDedupFiltered