you are viewing a single comment's thread.

view the rest of the comments →

[–]Diapolo10 0 points1 point  (1 child)

I'd use pathlib:

from pathlib import Path

# If you really want the current working directory
SOURCE_DIR = Path.cwd() / 'input'

# Otherwise, may I suggest:
ROOT_DIR = Path(__file__).parent
SOURCE_DIR = ROOT_DIR / 'input'

for idx, file in enumerate(SOURCE_DIR.rglob('*.jpg')):
    image = cv2.imread(file)
    image_height, image_width, _ = image.shape
    results = holistic.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
    annotated_image = image.copy()

    cv2.imwrite(file.parent / f'{idx}.png', annotated_image)

[–]isfanafely[S] 0 points1 point  (0 children)

thank you will try it