Last active
August 31, 2018 16:59
-
-
Save init27/87f13a7b128da74ac88f8d4a742f11d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import cv2 | |
ap = argparse.ArgumentParser() | |
ap.add_argument("-i", "--image", required=True, help="Path to the image") | |
args = vars(ap.parse_args()) | |
image = cv2.imread(args["image"]) | |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
cv2.imshow("Original", image) | |
cv2.imwrite("data/gray.jpg",gray) | |
r = 500.0 / image.shape[1] | |
dim = (500, int(image.shape[0] * r)) | |
resized = cv2.resize(image, dim, interpolation=cv2.INTER_AREA) | |
cv2.imshow("Resized (Width)", resized) | |
cv2.imwrite("data/ResizedImage.jpg",resized) | |
cv2.waitKey(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment