0
當從Matlab
提示調用OCR軟件OCRopus
直接,有一系列的錯誤時,該軟件是從shell提示符下直接調用,將不會出現:如何從Matlab調用OCRopus軟件或任何衝突軟件?
>> ! gnome-terminal -x bash ./sampleBash.sh
Traceback (most recent call last):
File "/usr/local/bin/ocropus-gpageseg", line 15, in <module>
from pylab import *
File "/usr/lib/pymodules/python2.7/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 156, in <module>
from matplotlib.cbook import is_string_like
File "/usr/lib/pymodules/python2.7/matplotlib/cbook.py", line 28, in <module>
import numpy as np
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
from . import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 19, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/usr/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 50, in <module>
from .linalg import *
File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 29, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /opt/MATLAB/R2012b/sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
其中sampleBash.sh
是:
#!/bin/bash -e
FILENAME='testfile.png'
ocropus-gpageseg --usefilename "$FILENAME"
$SHELL
似乎Matlab
的環境變量與系統bash shell的環境變量之間有衝突。關於如何發送'clean'shell環境到OCRopus
軟件(或任何其他類似軟件)的想法?
這不僅限於OCRopus調用,而且任何與在Matlab中調用shell的過程中設置的Matlab環境變量衝突的軟件都會面臨同樣的問題。
謝謝。
僅供參考,計算機視覺系統工具箱具有內置'ocr'功能。 – Dima 2014-11-12 19:19:52
謝謝@迪瑪。然而,這個問題的主要目的是如何處理來自Matlab內部的調用軟件,當它們與Matlab shell-call的環境設置發生衝突時。我會編輯這個問題來強調這一點。 – imriss 2014-11-13 13:23:24