I have an output from a code where coordinates of several rectangles (four corners x,y) are provided in a list of arrays containing nested lists, which looks as follows:
[array([[[x1, y1],
[x2, y2],
[x3, y3],
[x4, y4]]], dtype=float32),
...
array([[[x1, y1],
[x2, y2],
[x3, y3],
[x4, y4]]], dtype=float32)]
I have another list of corresponding rectangle IDs. which looks like that :
[[310]
[401]
...
[203]
[181]]
They are in the same order as the coordinates. I want to mashup both lists to get the following data structure:
[[rect_ID, [(x1,y1),(x2,y2),(x3,y3),(x4,y4)],
[rect_ID, [(x1,y1),(x2,y2),(x3,y3),(x4,y4)],
...
[rect_ID, [(x1,y1),(x2,y2),(x3,y3),(x4,y4)]]
I need then to sort the list by the rect_ID
Any ideas how to achieve that?
.tolist()output would be nested lists).