def ACE(M, t):
"""
Performs the adaptive cosin/coherent estimator 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:
X Jin, S Paswater, H Cline. "A Comparative Study of Target Detection
Algorithms for Hyperspectral Imagery." SPIE Algorithms and Technologies
for Multispectral, Hyperspectral, and Ultraspectral Imagery XV. Vol
7334. 2009.
"""
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_hat = np.cov(M.T)
G = lin.inv(R_hat)
results = np.zeros(N, dtype=np.float32)
##% From Broadwater's paper
##%tmp = G*S*inv(S.'*G*S)*S.'*G;
tmp = np.array(np.dot(t.T, np.dot(G, t)))
dot_G_M = np.dot(G, M[0:,:].T)
num = np.square(np.dot(t, dot_G_M))
for k in range(N):
denom = np.dot(tmp, np.dot(M[k], dot_G_M[:,k]))
results[k] = num[k] / denom
return results
评论列表
文章目录