Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("data.csv", "w") as fo:
- fo.write("filename,data,class\n")
- for i in glob.glob("D:\FYPPP\Getah\*.PNG"):
- print(i)
- label = i.split("-")[1].split(".")[0]
- label = 0 if label == 'S' else 1
- #show original image
- ori = imread(i)
- #change to gray
- im = cv2.imread(i, cv2.IMREAD_GRAYSCALE)
- plt.imshow(im,cmap=plt.get_cmap('gray'))
- plt.show()
- #contrast
- icon = exposure.rescale_intensity(im, in_range=(np.percentile(im, 5), np.percentile(im,20)))
- with warnings.catch_warnings():
- warnings.simplefilter("ignore")
- dt = img_as_ubyte(icon)
- plt.imshow(icon,cmap=plt.get_cmap('gray') )
- plt.show()
- # make image blur
- imed = cv2.medianBlur(dt.astype(np.uint8), 3)
- plt.imshow(imed,cmap=plt.get_cmap('gray') )
- plt.show()
- #a = lbp.ravel()
- #a = np.where(a == True, 1, 0)
- #a = ''.join(map(str, a.tolist()))
- #fo.write("{},{},{}\n".format(i, a, label))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement