计算分辨率

This commit is contained in:
nuknal
2024-06-07 13:03:01 +08:00
parent cf5012f2a8
commit c046da2321
6 changed files with 240 additions and 105 deletions

View File

@@ -13,7 +13,7 @@ import (
)
func (r *Registrator) SaveOriginalPanToGDALGTiff(tiffFile string) error {
err := savePanToGDALGTiff(r.PanImage, 0, 0, tiffFile)
err := savePanToGDALGTiff(r.PanImage, 0, 0, tiffFile, PanResolution)
if err != nil {
return err
}
@@ -21,7 +21,7 @@ func (r *Registrator) SaveOriginalPanToGDALGTiff(tiffFile string) error {
return nil
}
func savePanToGDALGTiff(pan gocv.Mat, topLeftX, topLeftY float64, tiffFile string) error {
func savePanToGDALGTiff(pan gocv.Mat, topLeftX, topLeftY float64, tiffFile string, resolution float64) error {
// log.Println("Saving PAN image to TIFF file:", tiffFile)
width := pan.Cols()
@@ -34,7 +34,7 @@ func savePanToGDALGTiff(pan gocv.Mat, topLeftX, topLeftY float64, tiffFile strin
}
defer ds.Close()
setGeoTransform(ds, topLeftX, topLeftY, PanResolution)
setGeoTransform(ds, topLeftX, topLeftY, resolution)
ds.SetMetadata("NBITS", "16")
// 将通道的数据转换为uint16数组