def MatchedFilter(M, t):
"""
Performs the matched filter 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)
tmp = np.array(np.dot(t.T, np.dot(G, t)))
w = np.dot(G, t)
return np.dot(w, M.T) / tmp
评论列表
文章目录