Skip to content

Commit 93443d1

Browse files
committed
0523
1 parent 6d1ec1a commit 93443d1

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

GLCM.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,52 @@
1111
a=np.ones((20,20))
1212

1313
I[a==1]=3
14-
print(I)
14+
print(I)
15+
16+
#"E:\ALOSPALSAR\TrainData\ALPSRP267211510\ALPSRP267211510_spe_48_4bands\ALPSRP267211510_spe48_0_4b_0.tif"
17+
import numpy as np
18+
from osgeo import gdal
19+
from scipy import fftpack
20+
import cv2
21+
22+
# "E:\ALOSPALSAR\TrainData\ALPSRP267211510\ALPSRP267211510_spe_48.txt"
23+
ds = gdal.Open(r'E:\ALOSPALSAR\Greenland201101\510\ALOS-P1_1__A-ORBIT__ALPSRP267211510_Cal_ML.tif')
24+
25+
spectrogramtxt = open('E:\ALOSPALSAR\TrainData\ALPSRP267211510\ALPSRP267211510_spe_48.txt', 'r')
26+
lines = spectrogramtxt.readlines()
27+
print(len(lines))
28+
print(lines[467])
29+
size=24
30+
31+
#"E:\ALOSPALSAR\TrainData\ALPSRP267211510\ALPSRP267211510_spe_48_4bands.txt"
32+
spetxt=open('E:\ALOSPALSAR\TrainData\ALPSRP267211510\ALPSRP267211510_spe_48_4bands.txt', 'w')
33+
def write_img(filename, XSIZE, YSIZE, Bands, DataType, np1, np2, np3):
34+
gtiff_driver = gdal.GetDriverByName('GTiff')
35+
out_ds = gtiff_driver.Create(filename,
36+
XSIZE, YSIZE, Bands, DataType)
37+
out_ds.SetProjection(ds.GetProjection())
38+
out_ds.SetGeoTransform(ds.GetGeoTransform())
39+
40+
out_band = out_ds.GetRasterBand(1)
41+
out_band.WriteArray(np1)
42+
out_band = out_ds.GetRasterBand(2)
43+
out_band.WriteArray(np2)
44+
out_band = out_ds.GetRasterBand(3)
45+
out_band.WriteArray(np3)
46+
return
47+
48+
path1 = (lines[1]).split(" ")[0]
49+
path2 = (lines[1]).split(" ")[0]
50+
path3 = (lines[1]).split(" ")[0]
51+
path4 = (lines[1]).split(" ")[0]
52+
print(path1)
53+
ds1 = gdal.Open(str(path1))
54+
band1 = ds1.GetRasterBand(1)
55+
spe1 = band1.ReadAsArray()
56+
img = np.array([spe1, spe1,spe1])
57+
58+
write_img('test.tif',24,24,3,band1.DataType,spe1,spe1,spe1)
59+
60+
61+
62+

img_statistics.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import numpy as np
22

3-
ALPSRP267211510 = [[-39.0113639831543, -13.956258773803711],#R
3+
ALPSRP267211510 = [[-39.0113639831543, -13.956258773803711],#R min max
44
[-42.140995025634766, -15.663641929626465],#G
55
[-36.93307876586914, -4.1313347816467285] ]#B
66

7+
ALPSRP176591600 =[[-40.27431106567383,-17.989925384521484],
8+
[-42.52381896972656, -20.901201248168945],
9+
[-33.98801040649414,-1.30019211769104]]
10+
11+
ALPSRP205991510 =[[-41.93055725097656,-11.455802917480469],
12+
[-43.62382125854492, -10.550777435302734],
13+
[-36.30093765258789,-3.19450306892395]]

0 commit comments

Comments
 (0)