全图配准

This commit is contained in:
nuknal
2024-11-01 15:52:53 +08:00
parent 9e58fbaed3
commit 921ca0b049
3 changed files with 15 additions and 22 deletions

View File

@@ -12,8 +12,8 @@ coregistration:
fus_band_order: "RGB"
radiation:
pan_remove_hf_noise: false
mss_remove_hf_noise: false
pan_remove_hf_noise: true
mss_remove_hf_noise: true
hf_radius_ratio: 0.49
min_hist_level: 0.3
max_hist_level: 0.6

View File

@@ -189,7 +189,7 @@ func (r *ImgProc) CalcDownPhaseCorrelation() error {
if err != nil {
return err
}
r.fileterPhaseShift([]float64{64, 64, 64, 64}, true)
r.fileterPhaseShift([]float64{0, 100, 200, 300})
r.calcMSSDeltaCoeffs(4)
r.DoMSSCoRegistration(false)
@@ -200,17 +200,19 @@ func (r *ImgProc) CalcDownPhaseCorrelation() error {
if err != nil {
return err
}
r.fileterPhaseShift([]float64{30.0}, true)
r.fileterPhaseShift([]float64{100.0})
r.calcMSSDeltaCoeffs(1)
r.DoPANCoRegistration()
// 裁掉位移部分
// r.MssHeight -= MaxShiftY
// r.PanHeight -= MaxShiftY * 4
// r.PanImage = r.PanImage.Region(image.Rect(0, 0, r.PanWidth, r.PanHeight))
// for i := 0; i < MssBands; i++ {
// r.registeredMssImages[i] = r.registeredMssImages[i].Region(image.Rect(0, 0, r.MssWidth, r.MssHeight))
// }
r.MssHeight -= MaxShiftY
r.PanHeight -= MaxShiftY * 4
pMat := r.PanImage.Region(image.Rect(0, 0, r.PanWidth, r.PanHeight))
r.PanImage = pMat.Clone()
pMat.Close()
for i := 0; i < MssBands; i++ {
r.registeredMssImages[i] = r.registeredMssImages[i].Region(image.Rect(0, 0, r.MssWidth, r.MssHeight))
}
return nil
}
@@ -252,7 +254,7 @@ func (r *ImgProc) CalcUpPhaseCorrelation() error {
// 基于 PAN 图像进行配准
r.doPhaseCorrelation(r.PanImage, upsampledMssImages,
r.PanHeight, r.PanWidth, blockHeight, blockWidth)
r.fileterPhaseShift([]float64{64, 64, 64, 64}, true)
r.fileterPhaseShift([]float64{64, 64, 64, 64})
r.calcMSSDeltaCoeffs(4)
r.DoMSSCoRegistration(false)
return nil
@@ -458,9 +460,6 @@ func (r *ImgProc) DoMSSCoRegistration(byEdge bool) error {
mapY.Close()
}
r.MssHeight -= 360
r.PanHeight -= 360 * 4
return nil
}
@@ -507,8 +506,5 @@ func (r *ImgProc) DoPANCoRegistration() error {
r.registeredMssImages[i] = registeredMSS
}
r.MssHeight -= 120
r.PanHeight -= 120 * 4
return nil
}

View File

@@ -45,7 +45,7 @@ func CV_PhaseCorrelate(panBlock, mssBlock gocv.Mat) (gocv.Point2f, float64) {
return shift, response
}
func (r *ImgProc) fileterPhaseShift(thredholds []float64, greaterThan bool) error {
func (r *ImgProc) fileterPhaseShift(thredholds []float64) error {
if len(thredholds) > 4 {
return errors.New("thredholds length should be less than 4")
}
@@ -57,10 +57,7 @@ func (r *ImgProc) fileterPhaseShift(thredholds []float64, greaterThan bool) erro
return false
}
if greaterThan {
return value.dy > float32(th)
}
return value.dy < float32(th)
return value.dy > float32(th-20) && value.dy < float32(th+20)
})
}