When i run this scipt an error appears: IndentationError: unindent does not match any outer indentation level. I dont know what it exactly means but i´ve tried in different code editors like sublime or visual studio code and there is the same problem. I´ve never had this problem before. The code:
import cv2
import numpy as np
video = cv2.VideoCapture(0)
while True:
check, frame = video.read()
if not check:
print("Camera doesn´t work")
break
pressed = cv2.waitKey(1)
if pressed == ord("q"):
break
blur = cv2.GaussianBlur(frame, (21, 21), 0)
hsv = cv2.cvtColor(blur, cv2.COLOR_BGR2HSV)
lower = [18, 50, 50]
upper = [35, 255, 255]
lower = np.array(lower, dtype="uint8")
upper = np.array(upper, dtype="uint8")
mask = cv2.inRange(hsv, lower, upper)
output = cv2.bitwise_and(frame,hsv, mask=mask)
cv2.imshow("Frame", output)
video.release()
cv2.DestroyAllWindows()
Edit: There is a missing closed at the mask line and there is a line missing (import numpy as np
), i made this error when I was copyng the code but any way the code gives me the same error.