ROl*_*ord 5 python-imaging-library pillow python-tesseract
我想用PyTesseract做一些图像OCR,并且我已经看到OpenCV的腐蚀和扩张功能对于噪声去除预处理非常有用。
由于PyTesseract已经需要PIL / Pillow,所以我想在PIL中进行噪声消除,而不是获得另一个库。PIL中有侵蚀或膨胀的等效物吗?(我的研究似乎建议可以以这种方式使用MaxFilter和MinFilter,但对我来说还不是很清楚。)
谢谢!
最好的选择是使用OpenCV python绑定。但是,如果要使用PIL / Pillow,则有ImageFilter模块:http : //pillow.readthedocs.io/en/3.1.x/reference/ImageFilter.html
dilation_img = src_img.filter(ImageFilter.MaxFilter(3))
erosion_img = src_img.filter(ImageFilter.MinFilter(3))
Run Code Online (Sandbox Code Playgroud)
示例中的数字3是蒙版大小;