PC2ortho.py 文件源码

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

项目:UAV-and-TrueOrtho 作者: LeonChen66 项目源码 文件源码
def main():
    data = pd.read_csv(
        'Leon_group1_densified_point_cloud.xyz',
        names=['X', 'Y', 'Z', 'C_R','C_G','C_B'],
        delim_whitespace=True)
    # Calculate Geotiff information
    Auto = True

    # If it is auto
    if Auto == True:
        # spacing could be changed
        spacing = 1.6*get_space(data)

        w = int((data.X.max() - data.X.min()) / spacing)
        h = int((data.Y.max() - data.Y.min()) / spacing)
        affine_par = [spacing,0,0,-spacing,data.X.min(),data.Y.max()]

    else:
        affine_name = ''
        affine_par = np.loadtxt(affine_name)   # input the affine name
        h = 1792
        w = 1053

    print(affine_par)
    print(h,w)
    # Generate DEM
    ortho = GEM_Dsm(data, h, w, 3, 0.15,affine_par)
    # save to tif
    ortho = ortho.astype(np.uint8)
    # ortho = cv2.medianBlur(ortho, 3)
    cv2.imwrite('ortho.tif',ortho)

    array2Raster(ortho,affine_par,'test.tif')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号