9.2. 子区域成像实验¶
9.2.1. 实验说明¶
从原始较大场景数据中, 选择不同大小的场景区域数据进行成像, 成像方法为调频变标算法(CSA). 一种方法是将选取子区域外的数据置零后成像, 另一种是仅用选取的子区域大小数据成像.
9.2.3. 真实数据实验¶
RADARSAT1数据实验¶
实验中所用数据为 RADARSAT1 卫星获得的数据, 成像区域为史丹利公园 (Stanley Park), 有关RADARSAT1的参数信息, 可参考 RADARSAT 产品介绍 小节.
实验代码¶
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-02-18 10:14:12
# @Author : Yan Liu & Zhi Liu (zhiliu.mind@gmail.com)
# @Link : http://iridescent.ink
# @Version : $1.0$
import iprs
import numpy as np
import scipy.io as scio
import matplotlib.pyplot as plt
imagingMethod = 'RDA'
# imagingMethod = 'OmegaK'
imagingMethod = 'CSA'
zpadar = (512, 512)
# zpadar = False
# zpadar = None
usesrc = True
# usesrc = False
usedpc = True
# usedpc = False
rcmc = False
rcmc = 32
fulltime = False
# fulltime = True
usemask = False
# usemask = True
sensor_name = 'RADARSAT1'
acquis_name = 'RADARSAT1'
sarplat = iprs.SarPlat()
sarplat.name = "sensor=" + sensor_name + "_acquisition=" + acquis_name
sarplat.sensor = iprs.SENSORS[sensor_name]
sarplat.acquisition = iprs.ACQUISITION[acquis_name]
sarplat.params = None
ROI = {
'SubSceneArea': None, # SceneArea
# 'SubSceneArea': [0.5, 0.5, 0.5, 0.5], # SceneArea/2.0
# 'SubEchoSize': None, # EchoSize
'SubEchoSize': [1., 1.],
# 'SubEchoSize': [1. / 3, 1. / 4],
# 'SubEchoSize': [1. / 6, 1. / 8],
'SubEchoSize': [1. / 12, 1. / 16],
}
sarplat.selection = ROI
ROIY = sarplat.selection['SubEchoSize'][0]
ROIX = sarplat.selection['SubEchoSize'][1]
# sarplat.selection = None
NstartX = int(sarplat.acquisition['EchoSize'][1] / 2. - ROIX / 2.)
NstartY = int(sarplat.acquisition['EchoSize'][0] / 2. - ROIY / 2.)
if fulltime:
mask = np.zeros(sarplat.acquisition['EchoSize'])
sarplat.selection = None
sarplat.select()
sarplat.printsp()
SA = sarplat.selection['SubSceneArea']
disk = '/mnt/d/'
# disk = 'D:/'
# datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1.mat'
# datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1_Squamish.mat'
# datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1_VancouverAirport.mat'
# datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1_Brackendale.mat'
datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1_EnglishBayShips.mat'
datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1_StanleyPark.mat'
# datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock1_UBC.mat'
# datafile = disk + 'DataSets/sar/RADARSAT/frombooks/mat/sardataRADARSAT1scene01AzimuthBlock2_River.mat'
data = scio.loadmat(datafile, struct_as_record=True)
temp = data['sardata']
temp = temp['rawdata'][0][0]
NendY = NstartY + ROIY
NendX = NstartX + ROIX
if fulltime:
Sr = np.zeros_like(temp)
Sr[NstartY:NendY, NstartX:NendX] = temp[NstartY:NendY, NstartX:NendX]
mask[NstartY:NendY, NstartX:NendX] = 1
else:
Sr = temp[NstartY:NendY, NstartX:NendX]
print(NstartY, NstartX, NendY, NendX)
Na, Nr = Sr.shape
print("SAR raw data: ", Sr.shape, Sr.dtype)
if imagingMethod is 'RDA':
# SI, _, _ = iprs.rda(Sr, sarplat, verbose=True)
SI = iprs.rda_adv(Sr, sarplat, zpadar=zpadar,
usesrc=usesrc, usedpc=usedpc, rcmc=rcmc, verbose=False)
if imagingMethod is 'CSA':
# SI = iprs.csa(Sr, sarplat, verbose=True)
SI = iprs.csa_adv(Sr, sarplat, zpadar=zpadar,
usesrc=usesrc, rcmc=rcmc, usedpc=usedpc, verbose=False)
SI = np.abs(SI)
data = {'SI': SI}
scio.savemat('./SI.mat', data)
print(SI.max(), SI.min())
SI = SI / SI.max()
print(SI.max(), SI.min())
SI = 20 * np.log10(SI + iprs.EPS)
print(SI.max(), SI.min())
# a = np.abs(SI.mean())
a = 50
SI = (SI + a) / a * 255
print(SI.max(), SI.min())
# SI = exposure.adjust_log(SI + iprs.EPS)
# SI = SI * 255
# SI = exposure.adjust_log(SI)
SI[SI < 0] = 0
SI = SI.astype('uint8')
SI = np.flipud(SI)
if fulltime and usemask:
SI = SI * mask
print("SI.shape: ", SI.shape)
Title = 'Imaging result of RDA('
Title = 'Imaging Result of ' + imagingMethod
if usesrc or rcmc:
Title = Title + '\n ('
if usesrc:
Title = Title + 'SRC+'
if rcmc:
Title = Title + 'RCMC+'
if usedpc:
Title = Title + 'DPC'
Title = Title + ")"
cmap = 'gray'
# cmap = 'hot'
# cmap = None
extent = SA
extent = None
plt.figure()
plt.subplot(211)
plt.imshow(np.abs(Sr), cmap=cmap)
plt.title("SAR raw data(Amplitude)")
plt.xlabel("Range")
plt.ylabel("Azimuth")
plt.subplot(212)
plt.imshow(SI, extent=extent, cmap=cmap)
plt.title(Title)
plt.xlabel("Range")
plt.ylabel("Azimuth")
plt.tight_layout()
plt.show()
plt.figure()
plt.imshow(SI, extent=extent, cmap='gray')
plt.xlabel("Range/m")
plt.ylabel("Azimuth/m")
plt.title(Title)
plt.show()
|