Optimization

This commit is contained in:
nuknal
2024-07-12 15:59:21 +08:00
parent b8ac9cf4d4
commit 783b83b30d
8 changed files with 34 additions and 24 deletions

View File

@@ -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,