hello anyone answer me how to pass command line arguments through python and how this error occurs usage: object_size.py [-h] -i IMAGE -w WIDTH object_size.py: error: argument -i/--image is required in this below code [closed]
from scipy.spatial import distance as dist
from imutils import perspective
from imutils import contours
import numpy as np
import argparse
import imutils
import cv2
...
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to the input image")
ap.add_argument("-w", "--width", type=float, required=True,
help="width of the left-most object in the image (in inches)")
args = vars(ap.parse_args())
image = cv2.imread(args["image"])
...
please do not throw a ton of unformatted code at us.
really, not an opencv problem.