恢复全图配准
This commit is contained in:
11
cmd/proc.go
11
cmd/proc.go
@@ -7,7 +7,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/airbusgeo/godal"
|
"github.com/airbusgeo/godal"
|
||||||
"github.com/duke-git/lancet/v2/mathutil"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"starwiz.cn/sjy01/image-proc/pkg/calculator"
|
"starwiz.cn/sjy01/image-proc/pkg/calculator"
|
||||||
@@ -79,7 +78,7 @@ var procCmd = &cobra.Command{
|
|||||||
processor.DoMomentMatching()
|
processor.DoMomentMatching()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := processor.DoPhaseCorrelation(true); err != nil {
|
if err := processor.DoPhaseCorrelation(false); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,10 +96,10 @@ var procCmd = &cobra.Command{
|
|||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
scenesCnt := mathutil.Min(len(panScenes), len(mssScenes))
|
// scenesCnt := mathutil.Min(len(panScenes), len(mssScenes))
|
||||||
for i := 0; i < scenesCnt; i++ {
|
// for i := 0; i < scenesCnt; i++ {
|
||||||
processor.RegisterScenes(panScenes[i], mssScenes[i])
|
// processor.RegisterScenes(panScenes[i], mssScenes[i])
|
||||||
}
|
// }
|
||||||
|
|
||||||
processor.OutputL1A(panScenes, mssScenes)
|
processor.OutputL1A(panScenes, mssScenes)
|
||||||
producer.CleanScenes(panScenes)
|
producer.CleanScenes(panScenes)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ func NewImgProc(rsmethod ResampleMethod) *ImgProc {
|
|||||||
var r ImgProc
|
var r ImgProc
|
||||||
r.resampleMethod = rsmethod
|
r.resampleMethod = rsmethod
|
||||||
r.blockH = 8
|
r.blockH = 8
|
||||||
r.blockW = 8
|
r.blockW = 4
|
||||||
|
|
||||||
return &r
|
return &r
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ func (r *ImgProc) CalcDownPhaseCorrelation() error {
|
|||||||
log.Infof("blockHeight=%d, blockWidth=%d", blockHeight, blockWidth)
|
log.Infof("blockHeight=%d, blockWidth=%d", blockHeight, blockWidth)
|
||||||
|
|
||||||
// 在 MSS 4 个波段上进行配准
|
// 在 MSS 4 个波段上进行配准
|
||||||
err := r.doPhaseCorrelation(downsampledPanImage,
|
err := r.doPhaseCorrelation(r.MssImages[0],
|
||||||
[]gocv.Mat{r.MssImages[0], r.MssImages[1], r.MssImages[2], r.MssImages[3]},
|
[]gocv.Mat{r.MssImages[0], r.MssImages[1], r.MssImages[2], r.MssImages[3]},
|
||||||
r.MssHeight, r.MssWidth, blockHeight, blockWidth)
|
r.MssHeight, r.MssWidth, blockHeight, blockWidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -193,37 +193,24 @@ func (r *ImgProc) CalcDownPhaseCorrelation() error {
|
|||||||
r.calcMSSDeltaCoeffs(4)
|
r.calcMSSDeltaCoeffs(4)
|
||||||
r.DoMSSCoRegistration(false)
|
r.DoMSSCoRegistration(false)
|
||||||
|
|
||||||
// 边缘检测后再做一次配准
|
|
||||||
|
|
||||||
// var mssEdges []gocv.Mat
|
|
||||||
// for band := 0; band < len(r.registeredMssImages); band++ {
|
|
||||||
// edge := CV_Sobel(r.registeredMssImages[band])
|
|
||||||
// mssEdges = append(mssEdges, edge)
|
|
||||||
// }
|
|
||||||
// r.doPhaseCorrelation(mssEdges[0], mssEdges,
|
|
||||||
// r.MssHeight, r.MssWidth, blockHeight, blockWidth)
|
|
||||||
// r.fileterPhaseShift([]float64{5, 5, 5, 5}, false)
|
|
||||||
// r.calcMSSDeltaCoeffs(4)
|
|
||||||
// r.DoMSSCoRegistration(true)
|
|
||||||
|
|
||||||
// 基于 PAN 图像进行配准
|
// 基于 PAN 图像进行配准
|
||||||
// err = r.doPhaseCorrelation(downsampledPanImage,
|
err = r.doPhaseCorrelation(downsampledPanImage,
|
||||||
// []gocv.Mat{r.registeredMssImages[0]},
|
[]gocv.Mat{r.registeredMssImages[0]},
|
||||||
// r.MssHeight, r.MssWidth, blockHeight, blockWidth)
|
r.MssHeight, r.MssWidth, blockHeight, blockWidth)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
// r.fileterPhaseShift([]float64{30.0}, true)
|
r.fileterPhaseShift([]float64{30.0}, true)
|
||||||
// r.calcMSSDeltaCoeffs(1)
|
r.calcMSSDeltaCoeffs(1)
|
||||||
// r.DoPANCoRegistration()
|
r.DoPANCoRegistration()
|
||||||
|
|
||||||
// 裁掉位移部分
|
// 裁掉位移部分
|
||||||
r.MssHeight -= MaxShiftY
|
// r.MssHeight -= MaxShiftY
|
||||||
r.PanHeight -= MaxShiftY * 4
|
// r.PanHeight -= MaxShiftY * 4
|
||||||
r.PanImage = r.PanImage.Region(image.Rect(0, 0, r.PanWidth, r.PanHeight))
|
// r.PanImage = r.PanImage.Region(image.Rect(0, 0, r.PanWidth, r.PanHeight))
|
||||||
for i := 0; i < MssBands; i++ {
|
// for i := 0; i < MssBands; i++ {
|
||||||
r.registeredMssImages[i] = r.registeredMssImages[i].Region(image.Rect(0, 0, r.MssWidth, r.MssHeight))
|
// r.registeredMssImages[i] = r.registeredMssImages[i].Region(image.Rect(0, 0, r.MssWidth, r.MssHeight))
|
||||||
}
|
// }
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -471,6 +458,9 @@ func (r *ImgProc) DoMSSCoRegistration(byEdge bool) error {
|
|||||||
mapY.Close()
|
mapY.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.MssHeight -= 360
|
||||||
|
r.PanHeight -= 360 * 4
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,5 +507,8 @@ func (r *ImgProc) DoPANCoRegistration() error {
|
|||||||
r.registeredMssImages[i] = registeredMSS
|
r.registeredMssImages[i] = registeredMSS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.MssHeight -= 120
|
||||||
|
r.PanHeight -= 120 * 4
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user