def GLRT(M, t):
"""
Performs the generalized likelihood test ratio algorithm for target
detection.
Parameters:
M: `numpy array`
2d matrix of HSI data (N x p).
t: `numpy array`
A target endmember (p).
Returns: `numpy array`
Vector of detector output (N).
References:
T F AyouB, "Modified GLRT Signal Detection Algorithm," IEEE
Transactions on Aerospace and Electronic Systems, Vol 36, No 3, July
2000.
"""
N, p = M.shape
# Remove mean from data
u = M.mean(axis=0)
M = M - np.kron(np.ones((N, 1)), u)
t = t - u;
R = lin.inv(np.cov(M.T))
results = np.zeros(N, dtype=np.float)
t_R_t_dot = np.dot(t, np.dot(R, t.T))
for k in range(N):
x = M[k]
R_x_dot = np.dot(R, x)
num = np.dot(t, R_x_dot)**2
denom = t_R_t_dot * (1 + np.dot(x.T, R_x_dot))
results[k] = num / denom
return results
评论列表
文章目录