def convex_hull_removal(pixel, wvl):
"""
Remove the convex-hull of the signal by hull quotient.
Parameters:
pixel: `list`
1D HSI data (p), a pixel.
wvl: `list`
Wavelength of each band (p x 1).
Results: `list`
Data with convex hull removed (p).
Reference:
Clark, R.N. and T.L. Roush (1984) Reflectance Spectroscopy: Quantitative
Analysis Techniques for Remote Sensing Applications, J. Geophys. Res., 89,
6329-6340.
"""
points = list(zip(wvl, pixel))
# close the polygone
poly = [(points[0][0],0)]+points+[(points[-1][0],0)]
hull = _jarvis.convex_hull(poly)
# the last two points are on the x axis, remove it
hull = hull[:-2]
x_hull = [u for u,v in hull]
y_hull = [v for u,v in hull]
tck = interpolate.splrep(x_hull, y_hull, k=1)
iy_hull = interpolate.splev(wvl, tck, der=0)
norm = []
for ysig, yhull in zip(pixel, iy_hull):
if yhull != 0:
norm.append(ysig/yhull)
else:
norm.append(1)
return norm, x_hull, y_hull
评论列表
文章目录