Skip to content

Instantly share code, notes, and snippets.

@Riyasharma-in
Created March 31, 2023 16:36
Show Gist options
  • Save Riyasharma-in/41b08715142c5010255058392c89e8fa to your computer and use it in GitHub Desktop.
Save Riyasharma-in/41b08715142c5010255058392c89e8fa to your computer and use it in GitHub Desktop.
Sorting and Automate Adjustment
# convert bounding boxes to [x, y, w, h] format
bboxes = [[box[0], box[1], box[2]-box[0], box[3]-box[1]] for box in bboxes]
# create a pandas dataframe from the bounding boxes
df = pd.DataFrame(bboxes, columns=['x','y','w', 'h'], dtype=int)
# add a column for the x-coordinate on the right side of the bounding box
df["x2"] = df["x"]+df["w"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment