Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import time
- import numpy as np
- from sklearn.externals import joblib
- from skimage.feature import hog
- import math
- from time import sleep
- # Read image
- _,src = cv2.imread("Applepic.JPG", cv2.IMREAD_GRAYSCALE)
- # Set threshold and maxValue
- thresh = 125
- maxValue = 255
- _,dst = cv2.threshold(src, 125, 255, cv2.THRESH_BINARY);
- cv2.imshow('src', src)
- #cv2.imshow('dst', dst)
- im = cv2.morphologyEx(dst, cv2.MORPH_ELLIPSE, (7,7))
- im2 = cv2.morphologyEx(dst, cv2.MORPH_OPEN, (7,7))
- #im2 = cv2.morphologyEx(dst, cv2.MORPH_CLOSE, np.ones((3,3), np.uint8))
- #cv2.imwrite("example.JPEG", dst)
- cv2.imshow('im', im)
- cv2.imshow('im2', im2)
- #cv2.imshow('im2', im2)
- cv2.waitKey(0)
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement