import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
tag = frame[235:245, 315:325]
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_red = np.array([20, 20, 50])
upper_red = np.array([255, 255, 130])
for i in range (235,245):
for j in range (315,325):
if cv2.inRange(tag[i][j],lower_red,upper_red):
break
cv2.imshow('image',frame)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
i want to check my middle 100 pixels in my 480,640 camera to see if they all fall in a certain color range and if they do to end the program but i cant find i way to compare the values of the middle 100 pixels with the values that i want