I am trying to threshold a live webcam video capture. I’d like to threshold it based on their intensity. I have included the full code below. When I run the code, only the CamHSV window is shown, the window for thresh isn’t shown.
sorry for the bad english
import numpy as np import cv2 as cv def changeRes(width, height): capture.set(3, width) capture.set(4, height) capture = cv.VideoCapture(2) while True: isTrue, frame = capture.read() CamHSV = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) cv.imshow('Cam', CamHSV) if cv.waitKey(1) &0xFF == ord('1'): break lower = np.array([0,48,80]) dtype = 'uint8' upper = np.array([18,255,255]) dtype = 'uint8' SkinTresholdHSV = cv.inRange(CamHSV,lower,upper) blurredHSV = cv.blur(SkinTresholdHSV,(3,3)) ret, thresh = cv.threshold(blurredHSV,0,255,cv.THRESH_BINARY) cv.imshow('thresh', thresh)