def classify(fn, M, E):
"""
Classify SAM or SID on a HSI cube
Can't be use with NormXCorr
"""
import pysptools.util as util
width, height, bands = M.shape
M = util.convert2d(M)
cmap = np.zeros(M.shape[0])
for i in range(M.shape[0]):
T = M[i]
floor = np.PINF
k = 0
for j in range(E.shape[0]):
R = E[j]
result = fn(T, R)
if result < floor:
floor = result
k = j
cmap[i] = k
return util.convert3d(cmap, width, height)
评论列表
文章目录