-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrwImages.py
More file actions
29 lines (21 loc) · 749 Bytes
/
rwImages.py
File metadata and controls
29 lines (21 loc) · 749 Bytes
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
29
import cv2
import argparse
# Parse command prompt args
parser = argparse.ArgumentParser(description='Read and write images')
parser.add_argument('--input', type=str, required=True,
help='[REQUIRED] Source image path')
parser.add_argument('--output', type=str, required=True,
help='[REQUIRED] Destination image path like: output.jpg')
args = parser.parse_args()
def main(args):
# Read image
image = cv2.imread(args.input)
# Display image
cv2.imshow('Image', image)
# Hold image until user press any key
cv2.waitKey(0)
# Close all windows
cv2.destroyAllWindows()
# Write image
cv2.imwrite(args.output, image)
main(args)