| [mmmat2set] [Up] [mmreadgray] | Image Information and Manipulation |
Return tuple with array of coord and array of values
def mmset2mat(A):
from MLab import max
from Numeric import put, ones, ravel, shape, NewAxis, array
(x,v)=A
if len(x) == 0: return array([0]).astype(v.typecode())
if len(x.shape) == 1: x = x[NewAxis,:]
dh,dw = max(abs(x))
h,w = (2*dh)+1, (2*dw)+1
M=ones((h,w)) * mmlimits(v)[0]
offset = x[:,0] * w + x[:,1] + (dh*w + dw)
put(M,offset,v)
M = M.astype(v.typecode())
return M
| [mmmat2set] [Up] [mmreadgray] | |
| Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |