Created
October 20, 2022 23:07
-
-
Save victormurcia/49141b03ed2720d427d252101bd0c831 to your computer and use it in GitHub Desktop.
Extract bounding box coordinates for a specific bounding box in current frame from json
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
| #Extract bounding box coordinates for a specific bounding box in current frame from json | |
| def makeRectangleFromJSON(bb_dict,whichBB): | |
| """ | |
| Args: | |
| bb_dict: (dict) dictionary from json file | |
| whichBB: (int) what bounding box is being processed | |
| Returns: | |
| x1 ,y1 ,x2 ,y2: (tuple) tuple containing pixel coordinates for the upper-left and lower-right corners of the bounding box | |
| """ | |
| x1 ,y1 ,x2 ,y2 = bb_dict[whichBB][0],bb_dict[whichBB][1],bb_dict[whichBB][2],bb_dict[whichBB][3] | |
| #print(x1 ,y1 ,x2 ,y2, ' These are the coordinates for bounding box ', whichBB) | |
| return(x1 ,y1 ,x2 ,y2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment