rpc
파일은 Rational Polynomial Coefficients (RPC)를 포함하는 파일로, 위성 영상의 기하학적 변환 및 정교한 지오코딩을 위해 사용
쉽게 말하면 RPC 모델은 위성 영상의 좌표를 지구 표면의 좌표로 변환하는 데 사용 위성의 위치 및 자세, 카메라 매개변수, 지형 정보를 포함하지 않고도 기하학적 변환을 수행할 수 있게 해줌
gdalwarp -rpc -to RPC_DEM=dem.tif pan.tif pan_geocoded.tif
dem 파일 존재 시, 지형 보정도 가능
Turkish 경우
with open(rpc_fpath, "r") as f:
rpc_str = f.readlines()
rpc_dict = dict()
for ln in rpc_str:
attr_name = ln[:-1].split(": ")[0].lower()
attr_value = float(ln[:-1].split(": ")[1].split(" ")[0])
rpc_dict[attr_name] = attr_value
attr_name_to_fix_list = ["line_num_coeff", "line_den_coeff", "samp_num_coeff", "samp_den_coeff"]
for attr_name_to_fix in attr_name_to_fix_list:
rpc_dict[attr_name_to_fix] = list()
for i in range(0, 20):
rpc_dict[attr_name_to_fix].append(rpc_dict[attr_name_to_fix + f"_{i + 1}"])
rpc_dict.pop(attr_name_to_fix + f"_{i + 1}")
import rasterio
import rasterio.rpc
rpc = rasterio.rpc.RPC(**rpc_dict)
with rasterio.open(input_image) as src_ds:
dst_ds_meta = src_ds.meta
dst_ds_meta["crs"] = "EPSG:4326"
with rasterio.open(output_image, "w", **dst_ds_meta) as dst_ds:
dst_ds.write(src_ds.read())
dst_ds.update_tags(ns="RPC", **rpc.to_gdal())
gdalwarp -rpc output_image output_rpc
Name | Description | Value Range | Units |
---|---|---|---|
ERR_BIAS | Error - Bias. The RMS bias error in meters per horizontal axis of all points in the image (-1.0 if unknown) | >= 0 | meters |
ERR_RAND | Error - Random. RMS random error in meters per horizontal axis of each point in the image (-1.0 if unknown) | >= 0 | meters |
LINE_OFF | Line Offset | >= 0 | pixels |
SAMP_OFF | Sample Offset | >= 0 | pixels |
LAT_OFF | Geodetic Latitude Offset | -90 to +90 | degrees |
LONG_OFF | Geodetic Longitude Offset | -180 to +180 | degrees |
HEIGHT_OFF | Geodetic Height Offset | unlimited | meters |
LINE_SCALE | Line Scale | > 0 | pixels |
SAMP_SCALE | Sample Scale | > 0 | pixels |
LAT_SCALE | Geodetic Latitude Scale | 0 < LAT_SCALE <= 90 | degrees |
LONG_SCALE | Geodetic Longitude Scale | 0 < LONG_SCALE <= 180 | degrees |
HEIGHT_SCALE | Geodetic Height Scale | HEIGHT_SCALE > 0 | meters |
LINE_NUM_COEFF (1-20) | Line Numerator Coefficients. Twenty coefficients for the polynomial in the Numerator of the rn equation. | unlimited | |
LINE_DEN_COEFF (1-20) | Line Denominator Coefficients. Twenty coefficients for the polynomial in the Denominator of the rn equation. | unlimited | |
SAMP_NUM_COEFF (1-20) | Sample Numerator Coefficients. Twenty coefficients for the polynomial in the Numerator of the cn equation. | unlimited | |
SAMP_DEN_COEFF (1-20) | Sample Denominator Coefficients. Twenty coefficients for the polynomial in the Denominator of the cn equation. | unlimited |