Guest User

Untitled

a guest
Oct 17th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3. from matplotlib import pyplot as plt
  4. img = cv2.imread("dps3.jpg")
  5. img2 = img
  6. img2[:] = [32,33,34]
  7. cv2.imshow('image',img2)
  8. kernel = np.ones((100,100),np.float32)/10000
  9. dst = cv2.filter2D(img,-1,kernel)
  10. cv2.imshow('image',dst)
  11. cv2.waitKey(0)
  12. cv2.destroyAllWindows()
  13.  
  14.  
  15. import cv2
  16. import numpy as np
  17.  
  18. def nothing(x):
  19. pass
  20.  
  21. # Create a black image, a window
  22. img = cv2.imread("dps3.jpg")
  23. cv2.namedWindow('image')
  24.  
  25. # create trackbars for color change
  26. cv2.createTrackbar('Smoothing','image',10,100,nothing)
  27. dst = img
  28.  
  29. while(1):
  30. cv2.imshow('image',dst)
  31. k = cv2.waitKey(1) & 0xFF
  32. if k == 27:
  33. break
  34. s = cv2.getTrackbarPos('Smoothing','image')
  35. if s == 0:
  36. s = 1
  37. kernel = np.ones((s,s),np.float32)/(s*s)
  38. dst = cv2.filter2D(img,-1,kernel)
  39. cv2.destroyAllWindows()
Add Comment
Please, Sign In to add comment