In computer vision projects, images are commonly used as command-line arguments in our scripts. In the following sections, we are going to see how we can read and write images.
Reading and writing images
Reading images in OpenCV
The following example, argparse_load_image.py, shows you how to load an image:
# Import the required packages
import argparse
import cv2
# We first create the ArgumentParser object
# The created object 'parser' will have the necessary information
# to parse the command-line arguments into data types.
parser = argparse.ArgumentParser()
# We add 'path_image' argument using add_argument() including a help. The type of this argument is string (by default)
parser.add_argument("path_image...