def OSP(M, E, t):
"""
Performs the othogonal subspace projection algorithm for target
detection.
Parameters:
M: `numpy array`
2d matrix of HSI data (N x p).
E: `numpy array`
2d matrix of background endmebers (p x q).
t: `numpy array`
A target endmember (p).
Returns: `numpy array`
Vector of detector output (N).
References:
Qian Du, Hsuan Ren, and Chein-I Cheng. "A Comparative Study of
Orthogonal Subspace Projection and Constrained Energy Minimization."
IEEE TGRS. Volume 41. Number 6. June 2003.
"""
N, p = M.shape
P_U = np.eye(p, dtype=np.float) - np.dot(E.T, lin.pinv(E.T))
tmp = np.dot(t.T, np.dot(P_U, t))
nu = np.zeros(N, dtype=np.float)
for k in range(N):
nu[k] = np.dot(t.T, np.dot(P_U, M[k])) / tmp
return nu
评论列表
文章目录