Here the code I'm using; I run it with Python 3.6 in Anaconda:
from imutils.perspective import four_point_transform
from imutils import contours
import numpy as np
import argparse
import imutils
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True,
help = 'path to the input image')
args = vars(ap.parse_args())]
and I get an error of:
runfile('/Users/suryavamsi/untitled5.py', wdir='/Users/suryavamsi')
usage: untitled5.py [-h] -1 IMAGE
untitled5.py: error: the following arguments are required: -1/--image
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
/Users/suryavamsi/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2870: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)