Python 相同的脚本,相同的库,不同的输出;为什么?
我使用枕头来调整和裁剪图像。Win XP 32位计算机和Linux Debian 8.0计算机上都安装了相同的库 运行下面的脚本会输出这样不同的结果,一个可以被识别,另一个不能 脚本:Python 相同的脚本,相同的库,不同的输出;为什么?,python,cross-platform,python-imaging-library,pillow,Python,Cross Platform,Python Imaging Library,Pillow,我使用枕头来调整和裁剪图像。Win XP 32位计算机和Linux Debian 8.0计算机上都安装了相同的库 运行下面的脚本会输出这样不同的结果,一个可以被识别,另一个不能 脚本: # -*- coding: utf-8 -*- from PIL import Image img = Image.open("a.BMP") c = 4 img = img.resize((1280*c, 1024*c), Image.ANTIALIAS) #box = (left,
# -*- coding: utf-8 -*-
from PIL import Image
img = Image.open("a.BMP")
c = 4
img = img.resize((1280*c, 1024*c), Image.ANTIALIAS)
#box = (left, upper, right, lower)
box = (2481, 548, 2666, 1344)
img2 = img.crop(box)
img2.save("test.pbm")
结果上的OCR:
$ ocrad test-win32.pbm --filter=numbers
27.29
$ ocrad test-linux.pbm --filter=numbers
__._9
以下是图片:
是什么导致了这一结果
编辑:
源图像(a.BMP
)将有助于检查,但由于我无法提供图像,因此我重新发布了问题:
- 输入图像:
- 在windows上输出图像:
- linux上的输出映像:
$ pngtopnm test2-win32.png | ocrad -s 4 -T 0.3
27.29
$ pngtopnm test2-linux.png | ocrad -s 4 -T 0.3
27.2_
平台差异?它们在视觉上看起来非常相似,但它们的md5不同。那么,Python的“代码可移植性”在哪里呢?(在这种情况下,可能是枕头)你能上传
a.pbm
,让人们可以用它进行实验吗?请参阅问题的“编辑”部分。
$ pngtopnm test2-win32.png | ocrad -s 4 -T 0.3
27.29
$ pngtopnm test2-linux.png | ocrad -s 4 -T 0.3
27.2_