使用 4*4*4 的控制点
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user