I am basically trying to preprocess an image for a better OCR recognition. I've decided to use scikit-image
(or should I use maybe something else)?
I am following the example shown here:
https://scikit-image.org/docs/stable/auto_examples/applications/plot_thresholding.html#id4
And, I have downloaded this script:
To test it with my own image, I've replaced this line
img = img_as_ubyte(data.page())
with this:
from skimage import io
img = img_as_ubyte(io.imread('test.jpg'))
But, I am getting this error:
File "/Users/janine/Downloads/test.py", line 207, in <module>
local_otsu = rank.otsu(img, selem)
File "/usr/local/lib/python3.9/site-packages/skimage/filters/rank/generic.py", line 1399, in otsu
return _apply_scalar_per_pixel_3D(generic_cy._otsu_3D, image,
File "/usr/local/lib/python3.9/site-packages/skimage/filters/rank/generic.py", line 278, in _apply_scalar_per_pixel_3D
image, selem, out, mask, n_bins = _handle_input_3D(image, selem, out, mask,
File "/usr/local/lib/python3.9/site-packages/skimage/filters/rank/generic.py", line 199, in _handle_input_3D
raise ValueError('Image dimensions and neighborhood dimensions'
ValueError: Image dimensions and neighborhood dimensionsdo not match
I have tried with multiple images so the problem is not the image.