File: image_paths.py

package info (click to toggle)
python-imutils 0.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,652 kB
  • sloc: python: 1,178; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 847 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# author:    Adrian Rosebrock
# website:   http://www.pyimagesearch.com

# USAGE
# from the demos folder:
# python image_paths.py

# import the necessary packages
from __future__ import print_function
# You'll need to force '../imutils' into the system path if testing
from imutils import paths

# loop over the image paths in the previous 'demo_images'
# directory and print the paths to the terminal
for imagePath in paths.list_images("../demo_images"):
    print(imagePath)

print('\nUsing `list_files` with a jpg file extension filter:\n')

# validExts must be a tuple
for imagePath in paths.list_files("../demo_images", validExts=('.jpg',)):
    print(imagePath)

print('\nUsing `list_files` with a contains filter:\n')

# validExts must be a tuple
for imagePath in paths.list_files("../demo_images", contains='bridge'):
    print(imagePath)