Skip to main content
. 2022 Feb 27;22(5):1875. doi: 10.3390/s22051875
Algorithm 2. Fragment of the Python code: other conversion function with associated parameters.
def process_frame(self, frame):
self.hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# transform into HSV color space⋯  blurred = cv2.GaussianBlur(self.hsv, (11,11), 0)
mask = cv2.inRange(blurred, self.color_low, self.color_high) # threshold
mask = cv2.erode(mask, None, iterations = 2)
mask = cv2.dilate(mask, None, iterations = 2)