I am trying to save the visualization resutls of my program which outputs images under a certain path. However, each time when it saves the image, it saves over the one before.
if visualize:
# Visualize
plt.xlim((0, 640))
plt.ylim((0, 480))
plt.imshow(scipy.misc.imresize(img, (480, 640)))
# Projections
for edge in edges_corners:
plt.plot(proj_corners_gt[edge, 0], proj_corners_gt[edge, 1], color='g', linewidth=3.0)
plt.plot(proj_corners_pr[edge, 0], proj_corners_pr[edge, 1], color='b', linewidth=3.0)
plt.gca().invert_yaxis()
#plt.show()
plt.savefig(outputdir + componentname + str(count) + '.png')
count = count + 1
In the end, I end up with like images that look like this:
There should be a way to "refresh" the image each time. Anyone knows what that update function is?