SHARE
TWEET

Untitled

a guest May 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import cv2
  2. import time
  3. import numpy as np
  4. from sklearn.externals import joblib
  5. from skimage.feature import hog
  6. import math
  7. from time import sleep
  8.  
  9. # Read image
  10. _,src = cv2.imread("Applepic.JPG", cv2.IMREAD_GRAYSCALE)
  11.  
  12. # Set threshold and maxValue
  13. thresh = 125
  14. maxValue = 255
  15.  
  16.  
  17. _,dst = cv2.threshold(src, 125, 255, cv2.THRESH_BINARY);
  18. cv2.imshow('src', src)
  19. #cv2.imshow('dst', dst)
  20. im = cv2.morphologyEx(dst, cv2.MORPH_ELLIPSE, (7,7))
  21. im2 = cv2.morphologyEx(dst, cv2.MORPH_OPEN, (7,7))
  22. #im2 = cv2.morphologyEx(dst, cv2.MORPH_CLOSE, np.ones((3,3), np.uint8))
  23. #cv2.imwrite("example.JPEG", dst)
  24. cv2.imshow('im', im)
  25. cv2.imshow('im2', im2)
  26. #cv2.imshow('im2', im2)
  27. cv2.waitKey(0)
  28. cv2.destroyAllWindows()
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top