From f7c4237c77f3a0a59be0fc161e884a659769cb02 Mon Sep 17 00:00:00 2001 From: nuknal Date: Thu, 6 Jun 2024 16:54:09 +0800 Subject: [PATCH] gsd --- pkg/auxilary/aux_platform.go | 6 +++--- pkg/producer/aux.go | 8 ++------ pkg/producer/image_registration.go | 2 ++ pkg/producer/meta.go | 4 ++-- pkg/producer/output.go | 4 ++-- pkg/producer/scenes.go | 2 +- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pkg/auxilary/aux_platform.go b/pkg/auxilary/aux_platform.go index 0f720e6..ec9363c 100644 --- a/pkg/auxilary/aux_platform.go +++ b/pkg/auxilary/aux_platform.go @@ -30,9 +30,9 @@ type AuxPlatform struct { QuatOrbJQ1 float64 // [37-40]轨道相对惯性系四元数矢部 的 Q1 值,量纲 1/0x40000000 QuatOrbJQ2 float64 // [41-44]Q2 值 QuatOrbJQ3 float64 // [45-48]Q3 值 - Eular1 float64 // [49-52]本体相对轨道姿态角,[Z]Yaw 测摆角,量纲:1/1000000 单位:rad - Eular2 float64 // [53-56] Pitch [Y] - Eular3 float64 // [57-60] Roll [X] + Eular1 float64 // [49-52]本体相对轨道姿态角,[X]Roll 测摆角,量纲:1/1000000 单位:rad + Eular2 float64 // [53-56] Pitch [Y] Pitch + Eular3 float64 // [57-60] Roll [Z] YAW DotEular1 float64 // [61-62]本体相对轨道角速度,量纲:1/100000 单位:rad DotEular2 float64 // [63-64] DotEular3 float64 // [65-66] diff --git a/pkg/producer/aux.go b/pkg/producer/aux.go index d448fd9..327b52f 100644 --- a/pkg/producer/aux.go +++ b/pkg/producer/aux.go @@ -39,10 +39,6 @@ func (r *Registrator) ScenePosition(scene *Scene) (topLeft, bottomRight orb.Poin lat, lng := calculator.CalculateDestination(lat0, lng0, float64(scene.Width)*scene.Meta.Gsd, float64(-scene.Y)*scene.Meta.Gsd) - - // lat0, lng0, h0 := calculator.WGS84XYZtoLatLngH(ap1.WGS84PosX, ap1.WGS84PosY, ap1.WGS84PosZ) - // fmt.Println("Scene Position End:", lat0, lng0, h0) - lat1, lng1 := calculator.CalculateDestination(lat, lng, float64(scene.Width)*scene.Meta.Gsd, float64(-scene.Height)*scene.Meta.Gsd) @@ -71,9 +67,9 @@ func (r *Registrator) ScenePosition(scene *Scene) (topLeft, bottomRight orb.Poin scene.Meta.SatPosX = ap.WGS84PosX scene.Meta.SatPosY = ap.WGS84PosY scene.Meta.SatPosZ = ap.WGS84PosZ - scene.Meta.Yaw = ap.Eular1 * 180 / math.Pi + scene.Meta.Yaw = ap.Eular3 * 180 / math.Pi scene.Meta.Pitch = ap.Eular2 * 180 / math.Pi - scene.Meta.Roll = ap.Eular3 * 180 / math.Pi + scene.Meta.Roll = ap.Eular1 * 180 / math.Pi // feature := geojson.NewFeature(poly) // fcs.Features = append(fcs.Features, feature) diff --git a/pkg/producer/image_registration.go b/pkg/producer/image_registration.go index 5983779..a6fe708 100644 --- a/pkg/producer/image_registration.go +++ b/pkg/producer/image_registration.go @@ -26,6 +26,8 @@ const ( OverlappedBlockLines = 3000 // 重叠块的行数 DownSampled ResampleMethod = "down_sample_pan" UpSampled ResampleMethod = "up_sample_mss" + PanResolution = 1.3 // mm/pixel + MssResolution = 5.2 ) type ResampleMethod string diff --git a/pkg/producer/meta.go b/pkg/producer/meta.go index bf61b7b..bd27526 100644 --- a/pkg/producer/meta.go +++ b/pkg/producer/meta.go @@ -73,10 +73,10 @@ func (r *Registrator) makeProductMeta(scene *Scene) *ProductMeta { switch scene.Type { case "PAN": - meta.Gsd = 1.25 + meta.Gsd = 1.3 meta.Bands = 1 case "MSS": - meta.Gsd = 5 + meta.Gsd = 5.2 meta.Bands = 4 } diff --git a/pkg/producer/output.go b/pkg/producer/output.go index 1b26251..a01c55c 100644 --- a/pkg/producer/output.go +++ b/pkg/producer/output.go @@ -34,7 +34,7 @@ func savePanToGDALGTiff(pan gocv.Mat, topLeftX, topLeftY float64, tiffFile strin } defer ds.Close() - setGeoTransform(ds, topLeftX, topLeftY, 1.25) + setGeoTransform(ds, topLeftX, topLeftY, PanResolution) ds.SetMetadata("NBITS", "16") // 将通道的数据转换为uint16数组 @@ -68,7 +68,7 @@ func (r *Registrator) SaveRegisteredMssToGDALGTiff(tiffFile string) error { gocv.Merge(r.registeredMssImages[:], &r.rgbirImage) err := SaveBGRToGDALGTiff(r.rgbirImage, - 4, 0, 0, 5, + 4, 0, 0, MssResolution, []godal.ColorInterp{godal.CIBlue, godal.CIGreen, godal.CIRed, godal.CIUndefined}, tiffFile) if err != nil { diff --git a/pkg/producer/scenes.go b/pkg/producer/scenes.go index de3e872..35ebf7a 100644 --- a/pkg/producer/scenes.go +++ b/pkg/producer/scenes.go @@ -144,7 +144,7 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e 4, scene.Meta.Corners.UpperLeft.Longitude, scene.Meta.Corners.UpperLeft.Latitude, - 5, + MssResolution, []godal.ColorInterp{godal.CIBlue, godal.CIGreen, godal.CIRed, godal.CIUndefined}, scene.Tiff) if err != nil {