-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSlider.py
More file actions
37 lines (29 loc) · 774 Bytes
/
Slider.py
File metadata and controls
37 lines (29 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import cv2 as cv
class Slider(object):
"""docstring for Slider"""
def __init__(self, src):
super(Slider, self).__init__()
image = cv.imread(src)
image = cv.GaussianBlur(image, (3,3), 1, 1)
cvted = cv.cvtColor(image, cv.COLOR_BGR2HSV)
seperated = cv.split(cvted)
hue = seperated[0]
self.img = hue
self.min = 0
self.max = 255
def getImage(self):
return self.img
def setMin(self, val):
self.min = val
self.thresh()
def setMax(self, val):
self.max = val
self.thresh()
"""private methods"""
def thresh(self):
a, lower = cv.threshold(self.img, self.min, 255, cv.THRESH_BINARY)
b, upper = cv.threshold(self.img, self.max, 255, cv.THRESH_BINARY_INV)
self.img = lower & upper
#return result
def printVersion():
print("Version 1.0")