I know how to extract the image if it was rendered in its own subplot, like desribed here:
Matplotlib figure to image as a numpy array
However, I have a slightly different code, which looks like the following:
_, ax = plt.subplots(1, figsize=(20,20))
height, width = image.shape[:2]
ax.set_ylim(height + 10, -10)
ax.set_xlim(-10, width + 10)
ax.axis('off')
ax.set_title(title)
ax.text(x,y,"blabla")
#...some more things happen with ax here
some_image = 255*np.random.rand(20,20)
some_image = some_image.astype(np.uint8)
#Somethings happen with the image here
#....
ax.imshow(some_image.astype(np.uint8))
Is it possible to get the shown ax
object as a numpy array for furhter processing without rewriting the code?