24 lines
695 B
Python
Executable File
24 lines
695 B
Python
Executable File
#!/usr/bin/python3
|
|
#https://pyimagesearch.com/2017/01/02/rotate-images-correctly-with-opencv-and-python/
|
|
|
|
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 image file")
|
|
args = vars(ap.parse_args()) """
|
|
|
|
image = cv2.imread('/home/caroline/Pictures/first.jpg')
|
|
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
|
gray = cv2.GaussianBlur(gray, (3, 3), 0)
|
|
edged = cv2.Canny(gray,90, 200)
|
|
|
|
resized_image = cv2.resize(edged, (800, 800))
|
|
cv2.imshow("Edged", resized_image)
|
|
cv2.waitKey(0)
|
|
|
|
# further tutorial on rotating and cutting off... |