26 lines
736 B
Go
26 lines
736 B
Go
package producer
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"gocv.io/x/gocv"
|
|
)
|
|
|
|
// https://medium.com/radix-ai-blog/banishing-the-jitters-stabilizing-satellite-imagery-with-opencvs-phase-correlation-3ba2dc6ac096
|
|
|
|
// tackle the brightness and contrast problem
|
|
// by performing phase correlation on detected
|
|
// edges instead of the raw image
|
|
|
|
func FindEdges(img0 gocv.Mat) gocv.Mat {
|
|
fmt.Println(img0.Cols(), img0.Rows(), img0.Type().String())
|
|
dst8 := gocv.NewMatWithSize(img0.Rows(), img0.Cols(), gocv.MatTypeCV8U)
|
|
defer dst8.Close()
|
|
gocv.Normalize(img0, &dst8, 0, 255, gocv.NormMinMax)
|
|
dst8.ConvertTo(&dst8, gocv.MatTypeCV8U)
|
|
dstEdge := gocv.NewMat()
|
|
gocv.Canny(dst8, &dstEdge, 10, 100)
|
|
dstEdge.ConvertTo(&dstEdge, gocv.MatTypeCV16U)
|
|
return dstEdge
|
|
}
|