I am writing a script to extract text from the images of questions like the one given below using tesseract
. But I am talking about 1000-10000 images per day so manualy applying the methods won't be feasible. Is it possible that I can apply some general things to all the images?
This image is here to show the quality of images not that it is handwritten.
So this image is having some noise, blur and all. I have used otsu thresholding
and closing
already. What other methods should be there for pre-processing functions that I can use on each image safely so that it does not hurt good quality images but improves bad quality.
In other terms, can I use a sharpening kernel
to every image? If yes, What should be average (minimal safe )filter size/value so that it does not hurt the good quality images
sharpen_kernel_choice1 = np.array([[-1,-1,-1], [-1,9,-1], [-1,-1,-1]])
sharpen_kernel_choise2 = np.array[[0,-1,0], [-1,9,-1], [0,-1,0]]
I am also thinking about using Wiener Filter
so that it can de-blur the image for example,
psf = np.ones((5, 5)) / 25 # what should be a safe kernel size
img = convolve2d(img, psf, 'same')
img += 0.1 * img.std() * np.random.standard_normal(img.shape) # what should be this value?
deconvolved_img = restoration.unsupervised_wiener(img, psf)