This commit is contained in:
nuknal
2024-10-29 16:30:02 +08:00
parent bd93e9f543
commit 9c2d93dff4
2013 changed files with 117 additions and 690917 deletions

View File

@@ -1,8 +1,10 @@
package producer
import (
"errors"
"image"
"github.com/duke-git/lancet/v2/slice"
log "github.com/sirupsen/logrus"
"gocv.io/x/gocv"
)
@@ -40,3 +42,25 @@ func (r *Registrator) calculateBlockPhaseShift(panBlock, mssBlock gocv.Mat) (goc
return shift, response
}
func (r *Registrator) fileterPhaseShift(thredholds []float64, greaterThan bool) error {
if len(thredholds) > 4 {
return errors.New("thredholds length should be less than 4")
}
for i := 0; i < len(thredholds); i++ {
th := thredholds[i]
r.phaseShifts[i] = slice.Filter(r.phaseShifts[i], func(i int, value PhaseShiftM) bool {
if value.response > 0.999999 {
return false
}
if greaterThan {
return value.dy > float32(th)
}
return value.dy < float32(th)
})
}
return nil
}