Optimization
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/paulmach/orb/planar"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/auxilary"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/calculator"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/payload"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -133,11 +134,11 @@ func (r *Registrator) SetSceneBoundary(scene *Scene) (topLeft, bottomRight orb.P
|
||||
log.Info("using attitude quaternion to calculate image boundary...")
|
||||
Qsat2eci := calculator.Quaternion{W: as.QuatAttstarQ0, X: as.QuatAttstarQ1, Y: as.QuatAttstarQ2, Z: as.QuatAttstarQ3}
|
||||
line0Start, _ := calculator.IntersectionAttitude(Qsat2eci, startPos84, startTime, 0)
|
||||
line0End, _ := calculator.IntersectionAttitude(Qsat2eci, startPos84, startTime, 9344)
|
||||
line0End, _ := calculator.IntersectionAttitude(Qsat2eci, startPos84, startTime, payload.PAN_PIXEL_WIDTH)
|
||||
|
||||
Qsat2eci = calculator.Quaternion{W: ae.QuatAttstarQ0, X: ae.QuatAttstarQ1, Y: ae.QuatAttstarQ2, Z: ae.QuatAttstarQ3}
|
||||
lineNStart, _ := calculator.IntersectionAttitude(Qsat2eci, endPos84, endTime, 0)
|
||||
lineNEnd, _ := calculator.IntersectionAttitude(Qsat2eci, endPos84, endTime, 9344)
|
||||
lineNEnd, _ := calculator.IntersectionAttitude(Qsat2eci, endPos84, endTime, payload.PAN_PIXEL_WIDTH)
|
||||
|
||||
// ------------------ 使用本体和轨道四元数计算图像边界 ECI------------------
|
||||
// log.Info("using orbit and body quaternion to calculate image boundary...")
|
||||
@@ -146,14 +147,14 @@ func (r *Registrator) SetSceneBoundary(scene *Scene) (topLeft, bottomRight orb.P
|
||||
// Qorbit2eci := calculator.Quaternion{X: as.QuatOrbJQ1, Y: as.QuatOrbJQ2, Z: as.QuatOrbJQ3}
|
||||
// Qorbit2eci.W = math.Sqrt(1 - Qorbit2eci.X*Qorbit2eci.X - Qorbit2eci.Y*Qorbit2eci.Y - Qorbit2eci.Z*Qorbit2eci.Z)
|
||||
// line0Start,_ := calculator.IntersectionECI(Qsat2orbit, Qorbit2eci, startPos84, startTime, 0)
|
||||
// line0End,_ := calculator.IntersectionECI(Qsat2orbit, Qorbit2eci, startPos84, startTime, 9344)
|
||||
// line0End,_ := calculator.IntersectionECI(Qsat2orbit, Qorbit2eci, startPos84, startTime, payload.PAN_PIXEL_WIDTH)
|
||||
|
||||
// Qsat2orbit = calculator.Quaternion{X: ae.QuatOrbitQ1, Y: ae.QuatOrbitQ2, Z: ae.QuatOrbitQ3}
|
||||
// Qsat2orbit.W = math.Sqrt(1 - Qsat2orbit.X*Qsat2orbit.X - Qsat2orbit.Y*Qsat2orbit.Y - Qsat2orbit.Z*Qsat2orbit.Z)
|
||||
// Qorbit2eci = calculator.Quaternion{X: ae.QuatOrbJQ1, Y: ae.QuatOrbJQ2, Z: ae.QuatOrbJQ3}
|
||||
// Qorbit2eci.W = math.Sqrt(1 - Qorbit2eci.X*Qorbit2eci.X - Qorbit2eci.Y*Qorbit2eci.Y - Qorbit2eci.Z*Qorbit2eci.Z)
|
||||
// lineNStart,_ := calculator.IntersectionECI(Qsat2orbit, Qorbit2eci, endPos84, endTime, 0)
|
||||
// lineNEnd,_ := calculator.IntersectionECI(Qsat2orbit, Qorbit2eci, endPos84, endTime, 9344)
|
||||
// lineNEnd,_ := calculator.IntersectionECI(Qsat2orbit, Qorbit2eci, endPos84, endTime, payload.PAN_PIXEL_WIDTH)
|
||||
|
||||
// ------------------ 使用本体和轨道四元数计算图像边界 ECEF------------------
|
||||
// log.Info("using orbit and body quaternion to calculate image boundary...")
|
||||
@@ -161,13 +162,13 @@ func (r *Registrator) SetSceneBoundary(scene *Scene) (topLeft, bottomRight orb.P
|
||||
// Qsat2orbit.W = math.Sqrt(1 - Qsat2orbit.X*Qsat2orbit.X - Qsat2orbit.Y*Qsat2orbit.Y - Qsat2orbit.Z*Qsat2orbit.Z)
|
||||
// vec84 := []float64{as.W84VelX, as.W84VelY, as.W84VelZ}
|
||||
// line0Start, _ := calculator.IntersectionECEF(Qsat2orbit, startPos84, vec84, 0)
|
||||
// line0End, _ := calculator.IntersectionECEF(Qsat2orbit, startPos84, vec84, 9344)
|
||||
// line0End, _ := calculator.IntersectionECEF(Qsat2orbit, startPos84, vec84, payload.PAN_PIXEL_WIDTH)
|
||||
|
||||
// Qsat2orbit = calculator.Quaternion{X: ae.QuatOrbitQ1, Y: ae.QuatOrbitQ2, Z: ae.QuatOrbitQ3}
|
||||
// Qsat2orbit.W = math.Sqrt(1 - Qsat2orbit.X*Qsat2orbit.X - Qsat2orbit.Y*Qsat2orbit.Y - Qsat2orbit.Z*Qsat2orbit.Z)
|
||||
// vec84 = []float64{ae.W84VelX, ae.W84VelY, ae.W84VelZ}
|
||||
// lineNStart, _ := calculator.IntersectionECEF(Qsat2orbit, endPos84, vec84, 0)
|
||||
// lineNEnd, _ := calculator.IntersectionECEF(Qsat2orbit, endPos84, vec84, 9344)
|
||||
// lineNEnd, _ := calculator.IntersectionECEF(Qsat2orbit, endPos84, vec84, payload.PAN_PIXEL_WIDTH)
|
||||
|
||||
// ------------------ 计算图像边界距离和分辨率 ------------------
|
||||
W0 := geo.Distance(orb.Point{line0Start.Lon, line0Start.Lat}, orb.Point{line0End.Lon, line0End.Lat})
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"gonum.org/v1/gonum/interp"
|
||||
"gonum.org/v1/gonum/spatial/r3"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/auxilary"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/payload"
|
||||
)
|
||||
|
||||
type Registrate interface{}
|
||||
@@ -21,8 +22,8 @@ type Registrate interface{}
|
||||
const (
|
||||
MssBands = 4
|
||||
PixelBytes = 2
|
||||
PanWidth = 9344 // 像素宽度
|
||||
MssWidth = 2336
|
||||
PanWidth = payload.PAN_PIXEL_WIDTH // 像素宽度
|
||||
MssWidth = payload.MSS_PIXEL_WIDTH
|
||||
BlockNH = 4
|
||||
BlockNW = 8
|
||||
OverlappedBlockLines = 3000 // 重叠块的行数
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/payload"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/rrc"
|
||||
)
|
||||
|
||||
@@ -24,7 +25,7 @@ func (r *Registrator) DoRRCbyLUT(lutDir string) error {
|
||||
}
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
lutMSS, err := rrc.LoadLUT(filepath.Join(lutDir, fmt.Sprintf("B%d.LUT", i+1)), 2336)
|
||||
lutMSS, err := rrc.LoadLUT(filepath.Join(lutDir, fmt.Sprintf("B%d.LUT", i+1)), payload.MSS_PIXEL_WIDTH)
|
||||
if err != nil {
|
||||
logrus.Error("load mss gray table failed")
|
||||
return err
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gocv.io/x/gocv"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/config"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/payload"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/rrc"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/utils"
|
||||
)
|
||||
@@ -47,8 +48,8 @@ func CleanScenes(scenes []*Scene) {
|
||||
// MSS 2336 * 2336 - 1764
|
||||
// PAN 9344 * 9344 - 7056
|
||||
func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err error) {
|
||||
hPAN := (9344 - 2336)
|
||||
hPANOverlap := 2336
|
||||
hPAN := (payload.PAN_PIXEL_WIDTH - payload.MSS_PIXEL_WIDTH)
|
||||
hPANOverlap := payload.MSS_PIXEL_WIDTH
|
||||
panScenesCnt := r.PanHeight / hPAN
|
||||
|
||||
for i := 0; i <= panScenesCnt; i++ {
|
||||
@@ -59,7 +60,7 @@ func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err e
|
||||
|
||||
scene := &Scene{
|
||||
Type: "PAN",
|
||||
Width: 9344,
|
||||
Width: payload.PAN_PIXEL_WIDTH,
|
||||
Height: y1 - i*hPAN,
|
||||
X: 0,
|
||||
Y: i * hPAN,
|
||||
@@ -74,7 +75,7 @@ func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err e
|
||||
name = strings.TrimSuffix(name, ".tiff")
|
||||
scene.SceneId = fmt.Sprintf("%s_%03d", name, i+1)
|
||||
|
||||
mat := r.PanImage.Region(image.Rect(0, i*hPAN, 9344, y1))
|
||||
mat := r.PanImage.Region(image.Rect(0, i*hPAN, payload.PAN_PIXEL_WIDTH, y1))
|
||||
if config.GCONFIG.Radiation.PANRemoveHfNoise {
|
||||
log.Println("applying hf noise filter on", scene.SceneId)
|
||||
matFiltered := rrc.HFNoiseFilter(mat, float64(mat.Cols())*config.GCONFIG.Radiation.HfRadiusRatio)
|
||||
@@ -101,7 +102,7 @@ func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err e
|
||||
|
||||
scene := &Scene{
|
||||
Type: "MSS",
|
||||
Width: 2336,
|
||||
Width: payload.MSS_PIXEL_WIDTH,
|
||||
Height: y1 - i*hMSS,
|
||||
X: 0,
|
||||
Y: i * hMSS,
|
||||
|
||||
Reference in New Issue
Block a user