gps image-time attitude 拟合精度

This commit is contained in:
nuknal
2024-09-05 15:10:21 +08:00
parent df6090df21
commit 52638b5ffe
8 changed files with 35 additions and 24 deletions

View File

@@ -27,9 +27,11 @@ func (r *Registrator) LoadAuxData() error {
attFile := strings.Replace(r.Params.AuxRawFile, ".AUX", ".att.txt", 1)
gpsFile := strings.Replace(r.Params.AuxRawFile, ".AUX", ".gps.txt", 1)
timeFile := strings.Replace(r.Params.AuxRawFile, ".AUX", ".imgtime.txt", 1)
r.AttQuaternion, _ = auxilary.StoreAtt(r.AuxPlatforms, attFile)
r.GPSs, _ = auxilary.StoreGPS(r.AuxPlatforms, gpsFile)
r.ImageTime = auxilary.NewImageTime(r.AuxPlatforms)
r.ImageTime.Store(timeFile)
return err
}
@@ -183,7 +185,7 @@ func (r *Registrator) calculateLatLonH(scene *Scene, row, col, H int) calculator
imgrow := row + scene.Y
imgtime, _ := r.ImageTime.Interp(imgrow, cross)
nanosecond := (imgtime - math.Floor(imgtime)) * 1000000000
nanosecond := (imgtime - math.Floor(imgtime)) * 1e9
sattime := time.Unix(int64(imgtime), int64(nanosecond)).UTC()
// 球面线性插值得到姿态四元数
@@ -195,5 +197,6 @@ func (r *Registrator) calculateLatLonH(scene *Scene, row, col, H int) calculator
groudPoint84, _ := calculator.Camera2GroundPoint(cECI,
[]float64{p84.X84, p84.Y84, p84.Z84},
sattime, ucam, H)
return groudPoint84
}

View File

@@ -6,15 +6,15 @@ type GridPoint struct {
// 网格点要覆盖边界,甚至大于边界
func gridImage2(m, n, height, width, k, hmin, hmax int) []*GridPoint {
a := int((height) / (m))
a := int((height) / (m + 1))
var lines []int
for i := 0; i <= m; i++ {
for i := 1; i <= m; i++ {
lines = append(lines, a*i)
}
b := int((width) / (n))
b := int((width) / (n + 1))
var samples []int
for i := 0; i <= n; i++ {
for i := 1; i <= n; i++ {
samples = append(samples, b*i)
}
@@ -23,14 +23,14 @@ func gridImage2(m, n, height, width, k, hmin, hmax int) []*GridPoint {
dh := (hmax - hmin) / (k)
var h []int
for i := 0; i <= k; i++ {
for i := 1; i <= k; i++ {
h = append(h, hmin+dh*i)
}
var points []*GridPoint
for i := 0; i < len(lines); i++ {
for j := 0; j < len(samples); j++ {
for l := 0; l < len(h); l++ {
for l := 0; l < len(h); l++ {
for i := 0; i < len(lines); i++ {
for j := 0; j < len(samples); j++ {
p := GridPoint{lines[i], samples[j], h[l]}
points = append(points, &p)
}

View File

@@ -56,8 +56,8 @@ type RPCModel struct {
// rational polynomial coeffients
func NewRPC(r *Registrator, scene *Scene, rpb string) *RPC {
rpc := RPC{
elevationLayer: 3,
gridsize: 19,
elevationLayer: 5,
gridsize: 20,
registrator: r,
scene: scene,
rpb: rpb,
@@ -97,6 +97,8 @@ func (rpc *RPC) generateVirtualGCP() {
rpc.scene.Height, rpc.scene.Width,
rpc.elevationLayer, int(rpc.minH), int(rpc.maxH))
ft, _ := os.Create("log/scene/" + rpc.scene.SceneId + ".time.txt")
defer ft.Close()
for _, p := range points {
p84 := rpc.registrator.calculateLatLonH(rpc.scene, p.Row, p.Col, p.H)
rpc.GCPs = append(rpc.GCPs, &GroundPoint{
@@ -106,6 +108,8 @@ func (rpc *RPC) generateVirtualGCP() {
Y: float64(p.Row),
X: float64(p.Col),
})
t, dt := rpc.registrator.ImageTime.Interp(p.Row+rpc.scene.Y, 16)
ft.WriteString(fmt.Sprintf("%d\t%.9f\t%.9f\n", p.Row, t, dt))
}
name := strings.Replace(rpc.scene.Tiff, ".tiff", ".gcp.geojson", -1)