MATLAB コードを Python に手動で変換していますが、1 行で行き詰っています。
MATLAB コード:
cashew_BW = threshad(cashew_GRAY(:,:,1),T);
cashew_BW = ~cashew_BW;
cashew_BW = imclose(cashew_BW, true(5));
cashew_BW = ~cashew_BW
Python 変換コード:
T = 112
se = [[1,1,1,1,1]]*5
cashew_BW = pymorph.threshad(cashew_GRAY, T, f2=None)
cashew_BW = np.logical_not(cashew_BW)
cashew_BW = 1*(cashew_BW)
cashew_BW = pymorph.close(cashew_BW, se)
cashew_BW = np.logical_not(cashew_BW)
cashew_BW = 1*(cashew_BW)
エラー:
Traceback (most recent call last):
File "check1.py", line 22, in <module>
cashew_BW = pymorph.close(cashew_BW, se)
File "/home/keerthi/anaconda2/lib/python2.7/site-packages/pymorph-0.96-py2.7.egg/pymorph/mmorph.py", line 1303, in close
return erode(dilate(f,Bc ),Bc )
File "/home/keerthi/anaconda2/lib/python2.7/site-packages/pymorph-0.96-py2.7.egg/pymorph/mmorph.py", line 1580, in dilate
x,v = mat2set(B)
File "/home/keerthi/anaconda2/lib/python2.7/site-packages/pymorph-0.96-py2.7.egg/pymorph/mmorph.py", line 4392, in mat2set
if len(A.shape) == 1: A = A[newaxis,:]
AttributeError: 'list' object has no attribute 'shape'
これを修正するにはどうすればよいですか?