DFT 带阻滤波器
This commit is contained in:
@@ -13,7 +13,9 @@ import (
|
||||
"github.com/paulmach/orb/geojson"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gocv.io/x/gocv"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/config"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/rrc"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/utils"
|
||||
)
|
||||
|
||||
type Scene struct {
|
||||
@@ -34,6 +36,12 @@ func (s *Scene) Cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
func CleanScenes(scenes []*Scene) {
|
||||
for _, scene := range scenes {
|
||||
scene.Cleanup()
|
||||
}
|
||||
}
|
||||
|
||||
// 对 PAN 和 配准后的MSS 在 Y 方向进行分景,景之间有25%的重叠
|
||||
// 默认分景大小:
|
||||
// MSS 2336 * 2336 - 1764
|
||||
@@ -67,9 +75,18 @@ func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err e
|
||||
scene.SceneId = fmt.Sprintf("%s_%03d", name, i+1)
|
||||
|
||||
mat := r.PanImage.Region(image.Rect(0, i*hPAN, 9344, y1))
|
||||
matFiltered := rrc.HFNoiseFilter(mat, float64(mat.Cols())*0.45)
|
||||
scene.Mat = append(scene.Mat, matFiltered)
|
||||
mat.Close()
|
||||
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)
|
||||
mat.Close()
|
||||
mat = matFiltered
|
||||
}
|
||||
|
||||
if config.GCONFIG.Radiation.SceneMomentMatching {
|
||||
rrc.DoMomentMatching(mat)
|
||||
}
|
||||
|
||||
scene.Mat = append(scene.Mat, mat)
|
||||
panScenes = append(panScenes, scene)
|
||||
}
|
||||
|
||||
@@ -95,16 +112,26 @@ func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err e
|
||||
continue
|
||||
}
|
||||
|
||||
for band := 0; band < 4; band++ {
|
||||
mat := r.registeredMssImages[band].Region(image.Rect(0, i*hMSS, 2336, y1))
|
||||
matFiltered := rrc.HFNoiseFilter(mat, float64(mat.Cols())*0.45)
|
||||
mat.Close()
|
||||
scene.Mat = append(scene.Mat, matFiltered)
|
||||
}
|
||||
|
||||
name := filepath.Base(r.Params.MssTiffFile)
|
||||
name = strings.TrimSuffix(name, ".tiff")
|
||||
scene.SceneId = fmt.Sprintf("%s_%03d", name, i+1)
|
||||
|
||||
for band := 0; band < 4; band++ {
|
||||
mat := r.registeredMssImages[band].Region(image.Rect(0, i*hMSS, 2336, y1))
|
||||
if config.GCONFIG.Radiation.MSSRemoveHfNoise {
|
||||
log.Println("applying hf noise filter on", scene.SceneId)
|
||||
matFiltered := rrc.HFNoiseFilter(mat, float64(mat.Cols())*config.GCONFIG.Radiation.HfRadiusRatio/4)
|
||||
mat.Close()
|
||||
mat = matFiltered
|
||||
}
|
||||
|
||||
if config.GCONFIG.Radiation.SceneMomentMatching {
|
||||
rrc.DoMomentMatching(mat)
|
||||
}
|
||||
|
||||
scene.Mat = append(scene.Mat, mat)
|
||||
}
|
||||
|
||||
mssScenes = append(mssScenes, scene)
|
||||
}
|
||||
|
||||
@@ -127,7 +154,7 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
||||
scene.Meta = r.makeProductMeta(scene)
|
||||
r.SetSceneBoundary(scene)
|
||||
|
||||
err := savePanToGDALGTiff(scene.Mat[0],
|
||||
err := utils.SavePanToGDALGTiff(scene.Mat[0],
|
||||
scene.Meta.Corners.UpperLeft.Longitude,
|
||||
scene.Meta.Corners.UpperLeft.Latitude,
|
||||
scene.Tiff,
|
||||
@@ -175,7 +202,7 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
||||
r.SetSceneBoundary(scene)
|
||||
|
||||
rgbirImage, _ := r.MergeMSSToBGRNIR(scene.Mat)
|
||||
err := SaveBGRToGDALGTiff(rgbirImage,
|
||||
err := utils.SaveBGRToGDALGTiff(rgbirImage,
|
||||
4,
|
||||
scene.Meta.Corners.UpperLeft.Longitude,
|
||||
scene.Meta.Corners.UpperLeft.Latitude,
|
||||
|
||||
Reference in New Issue
Block a user