Reading images in a folder

Loading files from a directory is a common use case. This is done by identifying a list of files in a directory, filtering the necessary files, and then executing a set of operations for each and every one of them. 

We will be using the sample-images folder from the GitHub repository. You are required to have a functioning project folder when running the following example:

using Imagesdirectory_path = "sample-images";directory_files = readdir(directory_path);directory_images = filter(x -> ismatch(r"\.(jpg|png|gif){1}$"i, x), directory_files);for image_name in directory_images  image_path = joinpath(directory_path, image_name);  image = load(image_path);  # other operationsend

This example introduces a number of new ...

Get Hands-On Computer Vision with Julia now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.