我正在寻找使用GDAL(OSGeo4W)将16位无符号tiff图像缩放为8位图像。但是,我想限制像素值,以使它们保持在8位图像的范围内。我的意思是,我想确保16位图像中的视觉比例在8位图像中表示(0-255)。使用gdal_translate将16位转换为8位会剪切像素值,并且不会生成RGB图像。我不确定从gdal_translate中调用什么函数和设置,或者是否有更好的选择。
GDALINFO
C:\>gdalinfo C:\Projects\Stormwater\ForPCI\images\1537TORO_6cm_04761_RGBI.tif
Driver: GTiff/GeoTIFF
Files: C:\Projects\Stormwater\ForPCI\images\1537TORO_6cm_04761_RGBI.tif
Size is 17310, 11310
Coordinate System is `'
Metadata:
TIFFTAG_DATETIME=2015:05:03 12:27:13
TIFFTAG_IMAGEDESCRIPTION=UltraCam-Lvl03
--------------
CAM_ID: UC-SXp-1-50215465 [3]
IMG_NO: 4761
RECORD_GUID: 8fc3d7a9-d2e5-40e5-babf-939f1f803dcf
IMG_GUID: C850D0A4-39CA-4BC8-ACD7-81A363D78C6E
FILE_GUID: 86C4F8E4-A2FD-43FB-B3B1-4C4ED8DF0E42
LICENSE_ID: 820342819
SOFTWARE: UltraCam Aerial Radiometry Core 12.6.1408.2501
PIXEL_SIZE_WIDTH: 6 [micron]
PIXEL_SIZE_HEIGHT: 6 [micron]
APERTURE: F_8
EXPOSURE_TIME: 0.002000000000 [s]
HIGH_ISO_MODE_CAPTURE: off
HIGH_ISO_MODE_PROCESSING: off
----- Inner Orientation -----
PRINCIPAL_DISTANCE: 100.500000000000 [mm]
PRINCIPAL_POINT_X: -0.000000000000 [mm]
PRINCIPAL_POINT_Y: 0.180000000000 [mm]
SENSOR_AREA_WIDTH: 103.860000000000 [mm]
SENSOR_AREA_HEIGHT: 67.860000000000 [mm]
-----------------------------
----- Exposure Annotation Data -----
MID_EXPOSURE_CORRECTION: 0.000762000000 [s]
FMS_SENSOR_CODE: UCXp
FMS_CAMERA_PORT: 1
FMS_EXPOSURE_NUMBER: 4761
FMS_PROJECT: 1537TORO
FMS_AREA: 1537TORO_6cm_6030
FMS_LINE_NUMBER: 47
FMS_SEGMENT_NUMBER: 1
FMS_WAY_POINT_NUMBER: 0
GPS_DATE: 150412
GPS_TIME: 162517
GPS_LATITUDE: N43.745319 [degree]
GPS_LONGITUDE: W079.358953 [degree]
GPS_ALTITUDE: 1159 [m]
GPS_POSITION_SOLUTION: GPS
GPS_TRACK_OVER_GROUND: 73 [degree]
GPS_ABOVE_GROUND_LEVEL: 1008.7 [m]
GPS_GROUND_SPEED: 80.4 [mps]
------------------------------------
----- Level-3 Parameters -----
IMG_TYPE: High resolution multi channel RGBI
ROTATION: 0 [degree]
------------------------------------
TIFFTAG_RESOLUTIONUNIT=1 (unitless)
TIFFTAG_SOFTWARE=UltraCam Aerial Radiometry Core 12.6.1408.2501
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0,11310.0)
Upper Right (17310.0, 0.0)
Lower Right (17310.0,11310.0)
Center ( 8655.0, 5655.0)
Band 1 Block=17310x1 Type=UInt16, ColorInterp=Red
Band 2 Block=17310x1 Type=UInt16, ColorInterp=Green
Band 3 Block=17310x1 Type=UInt16, ColorInterp=Blue
Band 4 Block=17310x1 Type=UInt16, ColorInterp=Undefined
1
您能否提供一些有关所使用图像类型的详细信息?
—
亚伦
例如,通过附加源文件的gdalinfo报告。还要编写您使用的确切gdal_translate命令。
—
user30184 '16
gdalinfo已作为更新添加到问题中。该图像是3级立体图像。使用的gdal_translate命令为:gdal_translate -ot字节input.tif output.tif
—
Ryan Garnett
也许16位图像的真实数据仅使用了整个范围的一小部分。例如使用QGIS检查直方图可能会发现这一点。您也可以尝试使用-scale参数gdal.org/gdal_translate.html。如果你的魔杖RGB输出从4段原se.lect他们三人用-b参数,例如
—
user30184
-b 1 -b 2 -b 3