- there are more than 24 thousand 2d (x,y) and 3d (x3d,y3d,z3d) points
- points are sorted in a database each with a label ... there are three type of labels (A , B, C)
- each label has a matching image
- all the rows are sorted by time
I need to animate these files as a video after plotting the 2d points as a box.
This code saves the images but that takes a lot of time and has failed two times.
ima = np.array(Image.open('a.png'), dtype=np.uint8)
imb = np.array(Image.open('b.png'), dtype=np.uint8)
imc = np.array(Image.open('c.png'), dtype=np.uint8)
# Create figure and axes
fig,ax = plt.subplots(1)
patch = patches.Rectangle((0, 0), 0, 0, fc='y')
for i in range(bb_2d_br_y.count()):
# Create figure and axes
fig,ax = plt.subplots(1)
height = bb_2d_br_y[i] - bb_2d_tl_y[i]
weidth = bb_2d_br_x[i] - bb_2d_tl_x[i]
# Create a Rectangle patch
rect = patches.Rectangle((centre_2d_x[i], centre_2d_y[i]), weidth, height, linewidth=1,
edgecolor='r', facecolor='none')
if locations[i] == 'a':
ax.imshow(ima)
elif locations[i] == 'b':
ax.imshow(imb)
else: #c
ax.imshow(imc)
# Add the patch to the Axes
ax.add_patch(rect)
fig.savefig(my_path + '/graph' + str(i) + '.png')