I am trying to save one frame in a video. The video was opened using pims. My script goes like this:
import pims
frames = pims.ND2_Reader('sample directory/file.nd2')
image = frames[123]
image.savefig('sample directory/file.png')
Then I received an error message say "'Frame' object has no attribute 'savefig'". How can I resolve this problem?
In the documentations, PIMS returns images as Frame objects, and Frames can be treated precisely the same as numpy arrays. This is same in ND2_Reader. And numpy arrays do not have such function called "savefig".
To save images, you can use the package PyAv mentioned in the documentation, Or simply use Opencv utilities which
import cv2
cv2.imwrite('sample directory/file.png', frame)
Or scipy utilities.