Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

How to input all images from a folder to a function in python instead of specifying individually?

$
0
0
I have this function called "analyze_picture". This is called when I specify the image file with path. How to automate this by adding loop so that this analyze_picture function is called for all the images in a folder(path). How to add loop so that every image is given as input to that function? if (choice == 'y'): run_loop = True window_name = "Analyze" print("Default path is set to data/sample/") print("Type q or quit to end program") while run_loop: path = "./data/sample/" file_name = input("Specify image file: ") if file_name == "q": run_loop = False else: path += file_name if os.path.isfile(path): analyze_picture(fisher_face_gender, path, window_size=(1280, 720), window_name=window_name) else: print("File not found!")

Viewing all articles
Browse latest Browse all 2088

Trending Articles