CV_Sobel
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user