Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os,glob
- import cv2
- j=0;
- for file in glob.glob("*.jpg"):
- im = cv2.imread(file)
- #dst = cv2.GaussianBlur(im,(5,5),cv2.BORDER_DEFAULT)
- dst = cv2.blur(im, (5, 5), anchor=(-1, -1), borderType=cv2.BORDER_DEFAULT)
- cv2.imwrite('blur-{0}.jpg'.format(j), dst)
- j += 1;
- ###Using Matplotlib
- import os,glob
- import cv2
- from matplotlib import pyplot as plt
- j=0;
- for file in glob.glob("*.jpg"):
- im = cv2.imread(file)
- #dst = cv2.GaussianBlur(im,(5,5),cv2.BORDER_DEFAULT)
- dst = cv2.blur(im, (5, 5), anchor=(-1, -1), borderType=cv2.BORDER_DEFAULT)
- #cv2.imwrite('blur-{0}.jpg'.format(j), dst)
- plt.imshow(dst)
- plt.axis('off')
- plt.savefig('blur-{0}.jpg'.format(j), bbox_inches='tight', transparent=True, pad_inches=0,dpi=300)
- j += 1;
- #plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement