使用 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
|
hmax = hmax + 500
|
||||||
hmin = hmin - 500
|
hmin = hmin - 500
|
||||||
dh := (hmax - hmin) / (k)
|
dh := (hmax - hmin) / (k)
|
||||||
|
|
||||||
var h []int
|
var h []int
|
||||||
for i := 1; i <= k; i++ {
|
for i := 0; i <= k; i++ {
|
||||||
h = append(h, hmin+dh*i)
|
h = append(h, hmin+dh*i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ type RPCModel struct {
|
|||||||
// rational polynomial coeffients
|
// rational polynomial coeffients
|
||||||
func NewRPC(r *Registrator, scene *Scene, rpb string) *RPC {
|
func NewRPC(r *Registrator, scene *Scene, rpb string) *RPC {
|
||||||
rpc := RPC{
|
rpc := RPC{
|
||||||
elevationLayer: 4,
|
elevationLayer: 3,
|
||||||
gridsize: 19,
|
gridsize: 3,
|
||||||
registrator: r,
|
registrator: r,
|
||||||
scene: scene,
|
scene: scene,
|
||||||
rpb: rpb,
|
rpb: rpb,
|
||||||
|
|||||||
@@ -70,17 +70,17 @@ func solveCoefficients(f, latVec, lonVec, heightVec *mat.VecDense) ([]float64, e
|
|||||||
denominator.SetVec(i, x0.AtVec(i+19))
|
denominator.SetVec(i, x0.AtVec(i+19))
|
||||||
}
|
}
|
||||||
|
|
||||||
num, den, err := solveNelderMead(numerator, denominator, f, latVec, lonVec, heightVec)
|
// num, den, err := solveNelderMead(numerator, denominator, f, latVec, lonVec, heightVec)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
var coeffs []float64
|
// var coeffs []float64
|
||||||
coeffs = append(coeffs, num.RawVector().Data...)
|
// coeffs = append(coeffs, num.RawVector().Data...)
|
||||||
for i := 1; i < 20; i++ {
|
// for i := 1; i < 20; i++ {
|
||||||
coeffs = append(coeffs, den.AtVec(i))
|
// coeffs = append(coeffs, den.AtVec(i))
|
||||||
}
|
// }
|
||||||
return coeffs, nil
|
// return coeffs, nil
|
||||||
|
|
||||||
// 迭代
|
// 迭代
|
||||||
var wm mat.Dense
|
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) {
|
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
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyPoly(poly *mat.VecDense,
|
func applyPolynominal(poly *mat.VecDense,
|
||||||
P, L, H float64) (v float64) {
|
P, L, H float64) (v float64) {
|
||||||
v = 0.0
|
v = 0.0
|
||||||
v += poly.AtVec(0)
|
v += poly.AtVec(0)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func objectiveFunc(numerator, denominator, f, latVec, lonVec, heightVec *mat.Vec
|
|||||||
errorV := predictedV - f.AtVec(i)
|
errorV := predictedV - f.AtVec(i)
|
||||||
errorSquared += errorV * errorV
|
errorSquared += errorV * errorV
|
||||||
}
|
}
|
||||||
return errorSquared / float64(n)
|
return errorSquared
|
||||||
}
|
}
|
||||||
|
|
||||||
func solveNelderMead(num, den, f, latVec, lonVec, heightVec *mat.VecDense) (*mat.VecDense, *mat.VecDense, error) {
|
func solveNelderMead(num, den, f, latVec, lonVec, heightVec *mat.VecDense) (*mat.VecDense, *mat.VecDense, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user