Skip to content

Instantly share code, notes, and snippets.

@offsouza
Last active June 9, 2020 19:16
Show Gist options
  • Save offsouza/b55d115b7ceb306b5bd5198adc91a6cd to your computer and use it in GitHub Desktop.
Save offsouza/b55d115b7ceb306b5bd5198adc91a6cd to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# coding: utf-8
import cv2
import numpy as np
image = cv2.imread('images/5.bmp')
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
blur = cv2.medianBlur(hsv ,11)
lower = np.array([132,113,223])
upper = np.array([140,153,255])
mask = cv2.inRange(blur, lower, upper)
res = cv2.bitwise_and(image,image, mask= mask)
cv2.imshow("mask ",mask)
cv2.imshow('stack', np.hstack([image, res]))
cv2.waitKey(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment