Advertisement
Javinator9889

Simple Image Processor - Python

Dec 5th, 2018
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. class ImageProcessor(object):
  2.     def __init__(self, image_path):
  3.         self.original = cv2.imread(image_path, cv2.IMREAD_COLOR)
  4.  
  5.     def processImage(self):
  6.         gray = cv2.cvtColor(self.original, cv2.COLOR_BGR2GRAY)
  7.         thresh = cv2.adaptiveThreshold(gray, 255, 1, 1, 11, 15)
  8.         self.showImage(thresh)
  9.  
  10.     def showImage(self, image):
  11.         cv2.imshow("Imagen", image)
  12.         cv2.waitKey()
  13.  
  14.  
  15. if __name__ == "__main__":
  16.     proc = ImageProcessor("p2.png")
  17.     proc.processImage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement