Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 2c36353
Author: Pericles Telemachou <[email protected]>
Date:   Thu Oct 26 12:39:52 2023 +1100

    Asserting some algorithms conform to `Feature2D`

commit 665eef3
Author: Pericles Telemachou <[email protected]>
Date:   Thu Oct 26 12:39:04 2023 +1100

    Add interface for `Feature2D` algorithms
  • Loading branch information
pericles-tpt committed Oct 26, 2023
1 parent ca77b8f commit 0d03716
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/xfeatures2d.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type SURF struct {
p unsafe.Pointer
}

var _ gocv.Feature2D = (*SURF)(nil)

// NewSURF returns a new SURF algorithm.
//
// For further details, please see:
Expand Down
30 changes: 30 additions & 0 deletions features2d.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,38 @@ package gocv
import "C"
import (
"image/color"
"io"
"reflect"
"unsafe"
)

type Detector interface {
Detect(src Mat) []KeyPoint
}

type Computer interface {
Compute(src Mat, mask Mat, kps []KeyPoint) ([]KeyPoint, Mat)
}

type DetectComputer interface {
DetectAndCompute(src Mat, mask Mat) ([]KeyPoint, Mat)
}

type Feature2D interface {
io.Closer
Detector
Computer
DetectComputer
}

// AKAZE is a wrapper around the cv::AKAZE algorithm.
type AKAZE struct {
// C.AKAZE
p unsafe.Pointer
}

var _ Feature2D = (*AKAZE)(nil)

// NewAKAZE returns a new AKAZE algorithm
//
// For further details, please see:
Expand Down Expand Up @@ -120,6 +142,8 @@ type BRISK struct {
p unsafe.Pointer
}

var _ Feature2D = (*BRISK)(nil)

// NewBRISK returns a new BRISK algorithm
//
// For further details, please see:
Expand Down Expand Up @@ -278,6 +302,8 @@ type KAZE struct {
p unsafe.Pointer
}

var _ Feature2D = (*KAZE)(nil)

// NewKAZE returns a new KAZE algorithm
//
// For further details, please see:
Expand Down Expand Up @@ -381,6 +407,8 @@ type ORB struct {
p unsafe.Pointer
}

var _ Feature2D = (*ORB)(nil)

// NewORB returns a new ORB algorithm
//
// For further details, please see:
Expand Down Expand Up @@ -905,6 +933,8 @@ type SIFT struct {
p unsafe.Pointer
}

var _ Feature2D = (*SIFT)(nil)

// NewSIFT returns a new SIFT algorithm.
//
// For further details, please see:
Expand Down

0 comments on commit 0d03716

Please sign in to comment.