How to detect a color in particular position?

i have written the code where it detects the black color everywhere in the picture ,but i want to detect only in the particular region .Can anyone help me with this ?
Thank you
Below is the code part.

lower = np.array([0, 0, 0])
upper = np.array([50, 50, 100])

video=cv2.imread('i.jpg')

while True:
 
    image=cv2.flip(image,1,0)
    img = cv2.cvtColor(video, cv2.COLOR_BGR2HSV) # Converting BGR image to HSV format
    mask = cv2.inRange(img, lower, upper)
    mask_contours, hierarchy = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) 

    # Finding position of all contours
    if len(mask_contours) != 0:
        for mask_contour in mask_contours:
            if cv2.contourArea(mask_contour) > 500:
                x, y, w, h = cv2.boundingRect(mask_contour)
                font = cv2.FONT_HERSHEY_SIMPLEX
                cv2.rectangle(video, (x, y), (x + w, y + h), (0, 0, 255), 3) 
                cv2.putText(video,'Black',(50,50), font, 1,(0,0,0),2)

    cv2.imshow("mask image", mask) 

    cv2.imshow("window", video)