I have two types of images, and they were both contrasted.
Type 1: (white and clean background)
Type 2: (some gray texture in background)
I could apply Gaussian blur and Thresholding to process the type 2 image to adjust it to the white background like type 1 as follow code:
type2_img = cv2.imread(type2.png)
# convert to grayscale
gray = cv2.cvtColor(type2_img , cv2.COLOR_BGR2GRAY)
# threshold the image using Otsu's thresholding
thresh = cv2.threshold(gray.copy(), 0, 255, cv2.THRESH_OTSU)[1]
# convert back to RGB
type2_img = cv2.cvtColor(thresh,cv2.COLOR_GRAY2RGB)
And, I could get the following result
:
However, I do not wish to apply the same method for type 1 images, since it is already satisfied condition.
So, are there any image processing methods within OpenCV that can differentiate type 2 images from type 1?




