Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pytesseract
- import argparse
- import cv2
- from PIL import Image
- image = cv2.imread('images/fuel_station_008-crop-kopi.png')
- orig = image.copy()
- # Color boundaries in GBR format
- lower_red = [35, 30, 150]; # 80, 45, 180
- upper_red = [180, 175, 255]; # 150, 150, 255
- lower = np.array(lower_red, dtype=np.uint8)
- upper = np.array(upper_red, dtype=np.uint8)
- mask = cv2.inRange(image, lower, upper)
- masked = cv2.bitwise_and(image, image, mask=mask)
- cv2.imshow("Original and masked", np.hstack([image, masked]))
- cv2.waitKey(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement