rpc 参数求解

This commit is contained in:
nuknal
2024-08-20 18:17:22 +08:00
parent ea23839bf2
commit 239d2787e3
4 changed files with 493 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import (
"math"
"os"
"path/filepath"
"strings"
"time"
log "github.com/sirupsen/logrus"
@@ -237,10 +238,24 @@ func (r *Registrator) SetSceneBoundary(scene *Scene) (topLeft, bottomRight orb.P
scene.Meta.Pitch = ae.Eular2 * 180 / math.Pi
scene.Meta.Roll = ae.Eular1 * 180 / math.Pi
// 计算RPC
rpc := NewRPC(r, scene, strings.Replace(scene.Tiff, ".tiff", ".rpb", 1))
if err := rpc.SolveLeastSquares(); err != nil {
log.Error("calculate RPC failed: ", err)
} else {
rpc.SaveRpb()
}
return
}
func (r *Registrator) SceneInAuxIndex(scene *Scene) (int, int) {
startPosInAux := r.sceneOffsetInAuxIndex(scene, 0)
endPosInAux := r.sceneOffsetInAuxIndex(scene, scene.Height)
return startPosInAux, endPosInAux
}
func (r *Registrator) sceneOffsetInAuxIndex(scene *Scene, offset int) int {
var auxForImageRow int
switch scene.Type {
case "MSS":
@@ -251,15 +266,9 @@ func (r *Registrator) SceneInAuxIndex(scene *Scene) (int, int) {
auxForImageRow = 16
}
startPosInAux := scene.Y / auxForImageRow
if startPosInAux >= len(r.AuxPlatforms) {
startPosInAux = len(r.AuxPlatforms) - 1
idx := (scene.Y + offset) / auxForImageRow
if idx >= len(r.AuxPlatforms) {
idx = len(r.AuxPlatforms) - 1
}
endPosInAux := (scene.Y + scene.Height) / auxForImageRow
if endPosInAux >= len(r.AuxPlatforms) {
endPosInAux = len(r.AuxPlatforms) - 1
}
return startPosInAux, endPosInAux
return idx
}