有没有可能使文件中的所有文字在阈值化后都是白底黑字。我在网上找了很多,但一直没有找到解决办法。我目前的阈值图像是。 https://i.ibb.co/Rpqcp7v/thresh.jpg
该文件需要被OCR读取,为此我需要将目前黑底白字的区域倒置。我怎样才能做到这一点?我目前的代码。
# thresholding
def thresholding(image):
# thresholds the image into a binary image (black and white)
return cv2.threshold(image, 120, 255, cv2.THRESH_BINARY)[1]