使用 4*4*4 的控制点

This commit is contained in:
nuknal
2024-09-04 10:43:20 +08:00
parent 19522db7c8
commit 884dee3c82
4 changed files with 17 additions and 16 deletions

View File

@@ -21,8 +21,9 @@ func gridImage2(m, n, height, width, k, hmin, hmax int) []*GridPoint {
hmax = hmax + 500
hmin = hmin - 500
dh := (hmax - hmin) / (k)
var h []int
for i := 1; i <= k; i++ {
for i := 0; i <= k; i++ {
h = append(h, hmin+dh*i)
}

View File

@@ -56,8 +56,8 @@ type RPCModel struct {
// rational polynomial coeffients
func NewRPC(r *Registrator, scene *Scene, rpb string) *RPC {
rpc := RPC{
elevationLayer: 4,
gridsize: 19,
elevationLayer: 3,
gridsize: 3,
registrator: r,
scene: scene,
rpb: rpb,

View File

@@ -70,17 +70,17 @@ func solveCoefficients(f, latVec, lonVec, heightVec *mat.VecDense) ([]float64, e
denominator.SetVec(i, x0.AtVec(i+19))
}
num, den, err := solveNelderMead(numerator, denominator, f, latVec, lonVec, heightVec)
if err != nil {
return nil, err
}
// num, den, err := solveNelderMead(numerator, denominator, f, latVec, lonVec, heightVec)
// if err != nil {
// return nil, err
// }
var coeffs []float64
coeffs = append(coeffs, num.RawVector().Data...)
for i := 1; i < 20; i++ {
coeffs = append(coeffs, den.AtVec(i))
}
return coeffs, nil
// var coeffs []float64
// coeffs = append(coeffs, num.RawVector().Data...)
// for i := 1; i < 20; i++ {
// coeffs = append(coeffs, den.AtVec(i))
// }
// return coeffs, nil
// 迭代
var wm mat.Dense
@@ -359,11 +359,11 @@ func localize(num, den *mat.VecDense, row, col float64) (P, L, H float64) {
}
func project(num, den *mat.VecDense, P, L, H float64) (v float64) {
v = applyPoly(num, P, L, H) / applyPoly(den, P, L, H)
v = applyPolynominal(num, P, L, H) / applyPolynominal(den, P, L, H)
return v
}
func applyPoly(poly *mat.VecDense,
func applyPolynominal(poly *mat.VecDense,
P, L, H float64) (v float64) {
v = 0.0
v += poly.AtVec(0)

View File

@@ -21,7 +21,7 @@ func objectiveFunc(numerator, denominator, f, latVec, lonVec, heightVec *mat.Vec
errorV := predictedV - f.AtVec(i)
errorSquared += errorV * errorV
}
return errorSquared / float64(n)
return errorSquared
}
func solveNelderMead(num, den, f, latVec, lonVec, heightVec *mat.VecDense) (*mat.VecDense, *mat.VecDense, error) {