什么是rpb/rpc文件?
rpb文件是用来存储用于遥感数据几何校正的RPC(Rational Polynomial Coefficients )模型的文件。类似的还有RPC文件,rpb与rpc文件只是格式不同,但包含的信息一致。其用于从图像坐标转换到地理坐标,L1级别的遥感数据是没有经过地理编码及几何校正的,因此可以通过数据包内的RPC文件进行数据几何校正(地理编码)。
RPC参数是有理函多项式函数模型的参数,可以将遥感影像的图像坐标(Line,Sample)即(行号,列号)与其对应的大地坐标(Lat,Long, Height)即(纬度,经度,高程)用比值多项式一一对应起来。RPC的概念得到了很大的关注是因为RPC不仅可以将传感器成像的物理模型隐藏起来,同时可以通过RPC模型校正出几何精度更高的卫星数据。不同数据厂商使用不同的方法生成RPC文件,但目前大多数都采取的非线性最小二乘法(Non linear Least square)。在成像期间,要拟合的数据由物理传感器模型生成。
更详细的了解参考:
卫星RPC有理多项式模型原理与正反算实现(python)-CSDN博客
看懂卫星遥感数据RPC文件-CSDN博客
rpb/rpc文件格式
rpb/rpc文件通常以文本文件或xml文件格式存储,对于国产高分数据多采用文本文件格式。
rpb文件***.rpb格式示例:
satId = "XXX";
bandId = "XXX";
SpecId = "XXX";
BEGIN_GROUP = IMAGE
errBias = 1.0;
errRand = 0.0;
lineOffset = +8.787000000000000e+03
sampOffset = +8.787000000000000e+03
latOffset = +5.197788782488139e+01
longOffset = +1.267276217581132e+02
heightOffset = -3.665824527965528e+01
lineScale = +8.787500000000000e+03
sampScale = +8.787500000000000e+03
latScale = +1.000000000000000e+01
longScale = +1.000000000000000e+01
heightScale = +5.036755360952578e+03
lineNumCoef = (
-2.489085287819830e-04,
-1.114244712474867e+01,
-6.168967195179680e+01,
+7.117708104229436e-05,
-1.395349820950307e-01,
+8.696093392117951e-03,
-9.575461257281814e-04,
+7.734382012664702e-01,
+2.574838134723002e-02,
+5.070051498763076e-06,
-5.809725628331042e-03,
+5.140801824748853e-03,
+4.289598645908305e-03,
+2.294752920112858e-03,
-9.015843957850683e-04,
+1.035394535926532e-02,
+1.232218463012144e-02,
+3.230339260864579e-02,
+1.047590959343009e-03,
+2.012768440253724e-08);
lineDenCoef = (
+1.000000000000000e+00,
+4.180010565216353e-04,
+1.324655197657377e-02,
-3.795304837771012e-05,
+2.545365596961364e-01,
-3.899350380745237e-04,
+5.589868166444578e-05,
+1.188681625956534e-03,
+6.863241299655094e-01,
-2.002690706130058e-04,
-2.072288733039329e-04,
+6.133069607160820e-03,
-1.449422536681941e-03,
-2.011485529779256e-06,
+3.500482182174969e-03,
+4.198143375537498e-04,
-2.285845110305829e-06,
-2.172369339810132e-04,
-4.144345265331140e-04,
-1.836223330071302e-09);
sampNumCoef = (
+3.116290493890969e-03,
+3.762565560709448e+01,
-1.780287250778219e+01,
+4.667388215545534e-02,
-1.418392610803636e+00,
-4.579691619531623e-02,
+3.030408501996984e-02,
-5.911326661297898e-01,
-2.781904253558995e+00,
-9.782108549302553e-05,
+1.239834648584903e-03,
+1.999566996539736e-01,
+6.939464036194087e-02,
-4.737705433260331e-02,
-2.858026398839704e-01,
-9.898030356627813e-03,
+2.240107912228240e-02,
+2.526433759914681e-03,
+4.945279318567586e-03,
-5.870434133733310e-05);
sampDenCoef = (
+1.000000000000000e+00,
+3.227373471194835e-01,
+3.944306307994457e-02,
-9.509654358749953e-03,
+1.207778166635094e+01,
-3.232572945854702e-02,
+1.355313365456889e-02,
-1.277420643579939e+01,
-2.837944635154219e+00,
-1.255397137925662e-03,
+8.474582054034840e-02,
+8.587278629665410e-03,
+1.984850060313677e-02,
-6.307604213724449e-04,
+2.407506405453826e-02,
-1.315252027876808e-02,
+2.805758450086238e-05,
-9.639541191512180e-02,
-1.882857688509176e-02,
+1.022672251679239e-05);
END_GROUP = IMAGE
END;
rpc文件***.rpc格式示例:
LINE_OFF :+8.787000000000000e+03 pixels
SAMP_OFF : +8.787000000000000e+03 pixels
LAT_OFF : +5.197788782488139e+01 degrees
LONG_OFF: +1.267276217581132e+02 degrees
HEIGHT_OFF: -3.665824527965528e+01 meters
LINE_SCALE: +8.787500000000000e+03 pixels
SAMP_SCALE: +8.787500000000000e+03 pixels
LAT_SCALE: +1.000000000000000e+01 degrees
LONG_SCALE: +1.000000000000000e+01 degrees
HEIGHT_SCALE :+5.036755360952578e+03 meters
LINE_NUM_COEFF_1:-2.489085287819830e-04
LINE_NUM_COEFF_2:-1.114244712474867e+01
LINE_NUM_COEFF_3:-6.168967195179680e+01
LINE_NUM_COEFF_4:+7.117708104229436e-05
LINE_NUM_COEFF_5:-1.395349820950307e-01
LINE_NUM_COEFF_6:+8.696093392117951e-03
LINE_NUM_COEFF_7:-9.575461257281814e-04
LINE_NUM_COEFF_8:+7.734382012664702e-01
LINE_NUM_COEFF_9:+2.574838134723002e-02
LINE_NUM_COEFF_10:+5.070051498763076e-06
LINE_NUM_COEFF_11:-5.809725628331042e-03
LINE_NUM_COEFF_12:+5.140801824748853e-03
LINE_NUM_COEFF_13:+4.289598645908305e-03
LINE_NUM_COEFF_14:+2.294752920112858e-03
LINE_NUM_COEFF_15:-9.015843957850683e-04
LINE_NUM_COEFF_16:+1.035394535926532e-02
LINE_NUM_COEFF_17:+1.232218463012144e-02
LINE_NUM_COEFF_18:+3.230339260864579e-02
LINE_NUM_COEFF_19:+1.047590959343009e-03
LINE_NUM_COEFF_20:+2.012768440253724e-08
LINE_DEN_COEFF_1:+1.000000000000000e+00
LINE_DEN_COEFF_2:+4.180010565216353e-04
LINE_DEN_COEFF_3:+1.324655197657377e-02
LINE_DEN_COEFF_4:-3.795304837771012e-05
LINE_DEN_COEFF_5:+2.545365596961364e-01
LINE_DEN_COEFF_6:-3.899350380745237e-04
LINE_DEN_COEFF_7:+5.589868166444578e-05
LINE_DEN_COEFF_8:+1.188681625956534e-03
LINE_DEN_COEFF_9:+6.863241299655094e-01
LINE_DEN_COEFF_10:-2.002690706130058e-04
LINE_DEN_COEFF_11:-2.072288733039329e-04
LINE_DEN_COEFF_12:+6.133069607160820e-03
LINE_DEN_COEFF_13:-1.449422536681941e-03
LINE_DEN_COEFF_14:-2.011485529779256e-06
LINE_DEN_COEFF_15:+3.500482182174969e-03
LINE_DEN_COEFF_16:+4.198143375537498e-04
LINE_DEN_COEFF_17:-2.285845110305829e-06
LINE_DEN_COEFF_18:-2.172369339810132e-04
LINE_DEN_COEFF_19:-4.144345265331140e-04
LINE_DEN_COEFF_20:-1.836223330071302e-09
SAMP_NUM_COEFF_1:+3.116290493890969e-03
SAMP_NUM_COEFF_2:+3.762565560709448e+01
SAMP_NUM_COEFF_3:-1.780287250778219e+01
SAMP_NUM_COEFF_4:+4.667388215545534e-02
SAMP_NUM_COEFF_5:-1.418392610803636e+00
SAMP_NUM_COEFF_6:-4.579691619531623e-02
SAMP_NUM_COEFF_7:+3.030408501996984e-02
SAMP_NUM_COEFF_8:-5.911326661297898e-01
SAMP_NUM_COEFF_9:-2.781904253558995e+00
SAMP_NUM_COEFF_10:-9.782108549302553e-05
SAMP_NUM_COEFF_11:+1.239834648584903e-03
SAMP_NUM_COEFF_12:+1.999566996539736e-01
SAMP_NUM_COEFF_13:+6.939464036194087e-02
SAMP_NUM_COEFF_14:-4.737705433260331e-02
SAMP_NUM_COEFF_15:-2.858026398839704e-01
SAMP_NUM_COEFF_16:-9.898030356627813e-03
SAMP_NUM_COEFF_17:+2.240107912228240e-02
SAMP_NUM_COEFF_18:+2.526433759914681e-03
SAMP_NUM_COEFF_19:+4.945279318567586e-03
SAMP_NUM_COEFF_20:-5.870434133733310e-05
SAMP_DEN_COEFF_1:+1.000000000000000e+00
SAMP_DEN_COEFF_2:+3.227373471194835e-01
SAMP_DEN_COEFF_3:+3.944306307994457e-02
SAMP_DEN_COEFF_4:-9.509654358749953e-03
SAMP_DEN_COEFF_5:+1.207778166635094e+01
SAMP_DEN_COEFF_6:-3.232572945854702e-02
SAMP_DEN_COEFF_7:+1.355313365456889e-02
SAMP_DEN_COEFF_8:-1.277420643579939e+01
SAMP_DEN_COEFF_9:-2.837944635154219e+00
SAMP_DEN_COEFF_10:-1.255397137925662e-03
SAMP_DEN_COEFF_11:+8.474582054034840e-02
SAMP_DEN_COEFF_12:+8.587278629665410e-03
SAMP_DEN_COEFF_13:+1.984850060313677e-02
SAMP_DEN_COEFF_14:-6.307604213724449e-04
SAMP_DEN_COEFF_15:+2.407506405453826e-02
SAMP_DEN_COEFF_16:-1.315252027876808e-02
SAMP_DEN_COEFF_17:+2.805758450086238e-05
SAMP_DEN_COEFF_18:-9.639541191512180e-02
SAMP_DEN_COEFF_19:-1.882857688509176e-02
SAMP_DEN_COEFF_20:+1.022672251679239e-05
rpb文件读取(matlab)
定义读取函数 rpb_reader.m:
function RPC=rpb_reader(f_in_name)
%author dou3516
% 2024-1-13
% 参考:https://blog.csdn.net/weixin_43955546/article/details/123702554
% 读取遥感RPB文件,输入经纬度,获取经纬度值对象的像素坐标。
%f_in_name: 输入RPB文件名称
% 1 读取RPB文件内容
fid1=fopen(f_in_name,'r');
read_one_line = fgetl(fid1);
read_one_line = fgetl(fid1);
read_one_line = fgetl(fid1);
read_one_line = fgetl(fid1);
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',});
errBias=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',});
errRand=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',});
RPC.line_off =str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',});
RPC.samp_off=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',});
RPC.lat_off =str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.lon_off=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.height_off=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.line_scale=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.samp_scale=str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.lat_scale =str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.lon_scale =str2double(temp(2));
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.height_scale =str2double(temp(2));
read_one_line = fgetl(fid1);
for i=1:20
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.line_num_coeff(i)=str2double(temp(1));
end
read_one_line = fgetl(fid1);
for i=1:20
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.line_den_coeff(i)=str2double(temp(1));
end
read_one_line = fgetl(fid1);
for i=1:20
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.samp_num_coeff(i)=str2double(temp(1));
end
read_one_line = fgetl(fid1);
for i=1:20
read_one_line = fgetl(fid1);
temp=strsplit(read_one_line,{';','=',')',','});
RPC.samp_den_coeff(i)=str2double(temp(1));
end
fclose(fid1);
示例读取代码:
fRPB = '***.rpb';
RPC = rpb_reader(fRPB);
读取到的RPC信息示例(注意不同于上述rpb文件的实际信息,仅做示例)如下:
参考:
遥感 RPC, RPB文件相关信息-CSDN博客