Advertisement
Guest User

Untitled

a guest
May 26th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. with open("data.csv", "w") as fo:
  2.  
  3. fo.write("filename,data,class\n")
  4.  
  5. for i in glob.glob("D:\FYPPP\Getah\*.PNG"):
  6.  
  7. print(i)
  8.  
  9. label = i.split("-")[1].split(".")[0]
  10. label = 0 if label == 'S' else 1
  11.  
  12. #show original image
  13. ori = imread(i)
  14.  
  15. #change to gray
  16. im = cv2.imread(i, cv2.IMREAD_GRAYSCALE)
  17. plt.imshow(im,cmap=plt.get_cmap('gray'))
  18. plt.show()
  19.  
  20. #contrast
  21. icon = exposure.rescale_intensity(im, in_range=(np.percentile(im, 5), np.percentile(im,20)))
  22. with warnings.catch_warnings():
  23. warnings.simplefilter("ignore")
  24. dt = img_as_ubyte(icon)
  25. plt.imshow(icon,cmap=plt.get_cmap('gray') )
  26. plt.show()
  27.  
  28. # make image blur
  29. imed = cv2.medianBlur(dt.astype(np.uint8), 3)
  30. plt.imshow(imed,cmap=plt.get_cmap('gray') )
  31. plt.show()
  32.  
  33. #a = lbp.ravel()
  34. #a = np.where(a == True, 1, 0)
  35. #a = ''.join(map(str, a.tolist()))
  36.  
  37. #fo.write("{},{},{}\n".format(i, a, label))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement