I want to apply different types of thresholding in a single image but on different parts of it. Is there any way to apply thresholding on specific part of the image rather than in the full image. Below is my code that applies in the full image. How to modify it? import cv2
image = cv2.imread('ANNOTATION01_monitor.PNG')
cv2.imshow('Original',image)
cv2.waitKey()
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('Grayscale', grayscale)
cv2.waitKey()
ret,thresh1 = cv2.threshold(after_img,30,255,cv2.THRESH_BINARY)
cv2.imshow('Thresholding', thresh1)
cv2.waitKey()
It applies thresholding on the full image. I want to apply this thresholding from (x1,y1) to (x2,y2) this coordinate range.