程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python remote sensing image processing application (18): normalization of remote sensing image by GDAL +numpy

編輯:Python

1. Using data

The input data used are remote sensing image data , It can be single band or multi band data .

Running environment :windows10  pycharm  python3.7.7  GDAL-3.2.3-cp37-cp37m-win_amd64.whl Bag, etc .

 2. Implement complete code

The complete code is as follows :

Batch processing is adopted , Import and export as file paths . You only need to modify the input / output file path to calculate the desired results .

"""
This code converts the remote sensing image into a unified processing
"""
import numpy as np
from osgeo import gdal
import os
# Normalize the remote sensing image Write function
def img_normalized(inputpath,output_filepath):
gdal.UseExceptions()
ds = gdal.Open(inputpath)
band01 = ds.GetRasterBand(1)
im_width, im_height=band01.XSize, band01.YSize
dim_z = ds.RasterCount # Number of image channels
# Get full path of output file
output_image = input_image_filepath.split("/")[-1]
print("output_image:", output_image)
output_image = output_filepath + output_image
output_image 

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved