hull_removal.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pysptools 作者: ctherien 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号