多云时无法配准

This commit is contained in:
nuknal
2024-05-30 09:17:51 +08:00
parent 1b0ab9f347
commit 7d9ec46750
10 changed files with 73 additions and 31 deletions

View File

@@ -19,7 +19,7 @@ func GTiffToJPG(ftiff, fjpg string, reversed bool) error {
defer ds.Close()
bands := ds.Bands()
log.Infof("TIFF file %s has %d bands", ftiff, len(bands))
log.Infof("creating JPG for TIFF file %s.", ftiff)
// 获取图像大小
width := bands[0].Structure().SizeX
@@ -62,9 +62,9 @@ func GTiffToJPG(ftiff, fjpg string, reversed bool) error {
img8 := gocv.NewMat()
defer img8.Close()
if bandsCnt == 1 {
img.ConvertToWithParams(&img8, gocv.MatTypeCV8UC1, 1.0/256.0*2, 0)
img.ConvertToWithParams(&img8, gocv.MatTypeCV8UC1, 1.0/256.0*1.5, 0)
} else {
img.ConvertToWithParams(&img8, gocv.MatTypeCV8UC3, 1.0/256.0*2, 0)
img.ConvertToWithParams(&img8, gocv.MatTypeCV8UC3, 1.0/256.0*1.5, 0)
if reversed {
channels := gocv.Split(img8)
gocv.Merge([]gocv.Mat{channels[2], channels[1], channels[0]}, &img8)