Home > other >  Opencv processing of remote sensing data
Opencv processing of remote sensing data

Time:10-11

Use the following code to handle no yoga get full shadow like number one, and the lack of some properties with the source data, heavyweight directions
# - * - coding: utf-8 - * -
# - * - coding: cp936 - * -
GBK # coding=
The import cv2
The import numpy as np
The import math


Def copy (img, new1) :
New1=np. Zeros (img. Shape, dtype='uint16')

New1 [: :]=img [: :]


Def computL (L, Dn, S) :
Dn=pow (Dn, 3/2)
S=pow (10, 10)
L=Dn * S
Return (L)


If __name__=="__main__ ':


Img1=cv2. Imread (' C:/Users/Gentry Long/Desktop/ygyg LuoJia1-01 _lr201903142986_20190311145935_hdr_0037_gec. Tif ', 2)
Print (img1)
# image format conversion
Img=cv2. CvtColor (img1, cv2 COLOR_BGR2GRAY)
# imgFile='C:/Users/Gentry Long/Desktop/LuoJia1-01 _lr201903142986_20190311145935_hdr_0037_gec. Tif'
# img1=cv2. Imread (imgFile)
# if isinstance (img1, np. Ndarray) :
# pass
# the else:
# print (img1)
# img=cv2. CvtColor (img1, cv2 COLOR_BGR2GRAY)

# calculation JD
I=2019
J=3
14 K=
JD - 32075 + 1461=K * (I + + (14) J - 4800/12)/4 + 367 * (J - 2 - (J - 14)/12 * 12)/12-3 * (
(I + + 4900 (J - 14)/12)/100)/4

# set ESUNI value
ESUNI71=196.9

# calculation solar-terrestrial distance D
1-0.01674 * D=math. Cos ((0.9856 * * (JD - 4) math. The PI/180))

# calculating solar zenith Angle
Cos=math. Cos (math.h radians (90-41.3509605))
System=(math. PI * D * D)/(ESUNI71 * cos * cos)

# the atmospheric correction parameter Settings
Lmini=6.2
Lmax=293.7
Qcal=1
Qmax=255
LIMIN=Lmini + (Qcal * (Lmax - Lmini)/Qmax)
ESUNI71 LI=(0.01 * * cos * cos)/(math. PI * D * D)
Lhazel=LIMIN - LI



Print (' D='D)
Print (' cosZS='cos)
Print (' Lhazel='Lhazel)

Reflectivity of # of image

Result=np. Zeros (img. Shape, dtype='uint16')

For I in range (0, img. Shape [0]) :

For j in range (0, img. Shape [0]) :
Lsat=computL (1.18070871, img [I, j], 7.38070852)

Result [I, j]=Intel * (Lsat - Lhazel) * 1000

# to save images

Cv2. Imwrite (" D: \ \ result. Tif ", result)

Cv2. NamedWindow (" Image ")

Cv2. Imshow (" Image ", result)

cv2.waitKey(0)
  • Related