Skip to content

Commit

Permalink
fix: correct signature for FindHomography, since dst is actually targ…
Browse files Browse the repository at this point in the history
…et format for the operation, not something changed by the operation

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Nov 24, 2024
1 parent 0698277 commit c9ff49e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions imgproc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1839,8 +1839,8 @@ const (
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga4abc2ece9fab9398f2e560d53c8c9780
func FindHomography(srcPoints Mat, dstPoints *Mat, method HomographyMethod, ransacReprojThreshold float64, mask *Mat, maxIters int, confidence float64) Mat {
return newMat(C.FindHomography(srcPoints.Ptr(), dstPoints.Ptr(), C.int(method), C.double(ransacReprojThreshold), mask.Ptr(), C.int(maxIters), C.double(confidence)))
func FindHomography(srcPoints Mat, targetPoints Mat, method HomographyMethod, ransacReprojThreshold float64, mask *Mat, maxIters int, confidence float64) Mat {
return newMat(C.FindHomography(srcPoints.Ptr(), targetPoints.Ptr(), C.int(method), C.double(ransacReprojThreshold), mask.Ptr(), C.int(maxIters), C.double(confidence)))
}

// DrawContours draws contours outlines or filled contours.
Expand Down
14 changes: 7 additions & 7 deletions imgproc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2079,16 +2079,16 @@ func TestGetAffineTransform2f(t *testing.T) {
func TestFindHomography(t *testing.T) {
src := NewMatWithSize(4, 1, MatTypeCV64FC2)
defer src.Close()
dst := NewMatWithSize(4, 1, MatTypeCV64FC2)
defer dst.Close()
target := NewMatWithSize(4, 1, MatTypeCV64FC2)
defer target.Close()

srcPoints := []Point2f{
{193, 932},
{191, 378},
{1497, 183},
{1889, 681},
}
dstPoints := []Point2f{
targetPoints := []Point2f{
{51.51206544281359, -0.10425475260813055},
{51.51211051314331, -0.10437947532732306},
{51.512222354139325, -0.10437679311830816},
Expand All @@ -2100,15 +2100,15 @@ func TestFindHomography(t *testing.T) {
src.SetDoubleAt(i, 1, float64(point.Y))
}

for i, point := range dstPoints {
dst.SetDoubleAt(i, 0, float64(point.X))
dst.SetDoubleAt(i, 1, float64(point.Y))
for i, point := range targetPoints {
target.SetDoubleAt(i, 0, float64(point.X))
target.SetDoubleAt(i, 1, float64(point.Y))
}

mask := NewMat()
defer mask.Close()

m := FindHomography(src, &dst, HomographyMethodAllPoints, 3, &mask, 2000, 0.995)
m := FindHomography(src, target, HomographyMethodAllPoints, 3, &mask, 2000, 0.995)
defer m.Close()

pvsrc := NewPoint2fVectorFromPoints(srcPoints)
Expand Down

0 comments on commit c9ff49e

Please sign in to comment.