I have written code for taking snap-shot from a selected video and save to image using OpenCV
and save the file in a chosen directory, but I don't know how Python
can get the list of files in the directory in real-time. Now I have written Python code to get the list of files in the directory but as soon as the file list is updated, the program ends. It is unable to read the directory when images in it get updated or there is a new Image created inside it.
My code:
from PIL import Image
import glob
image_list = []
for filename in glob.glob('path/*.jpg'):
im=Image.open(filename)
image_list.append(im)
print(image_list)