As shown in the example picture below, if the background and the color of the object to be obtained are similar, What would be good to use as a preprocessing before proceeding with binarization?
import cv2
img = cv2.imread(‘image.jpg’, cv2.IMREAD_GRAYSCALE)
ret, binary = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
cv2.imshow(‘img’, img)
cv2.imshow(‘binary’, binary)
cv2.waitKey(0)
cv2.destroyAllWindows()
I used the code below, but it’s hard to separate.
What is the pre-processing method for neat binarization?