I have 2 types of image to deal. one with white background and another type with dark background. My requirement is to apply different thresholds for each type
for ex : for white back ground
(thresh, img_bin) = cv2.threshold(img, 128 , 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
for dark back ground
(thresh, img_bin) = cv2.threshold(img, 128 , 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)
I am reading images using cv.imread(img,0)
I am doing morphological transformation , so i need to invert the white back ground image. but for the dark background i don't want to invert.