-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIFT custom #1186
SIFT custom #1186
Conversation
features2d.go
Outdated
@@ -943,6 +943,39 @@ func NewSIFT() SIFT { | |||
return SIFT{p: unsafe.Pointer(C.SIFT_Create())} | |||
} | |||
|
|||
func NewSIFTCustom(nfeatures *int, nOctaveLayers *int, contrastThreshold *float64, edgeThreshold *float64, sigma *float64) SIFT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func NewSIFTCustom(nfeatures *int, nOctaveLayers *int, contrastThreshold *float64, edgeThreshold *float64, sigma *float64) SIFT { | |
func NewSIFTWithParams(nfeatures *int, nOctaveLayers *int, contrastThreshold *float64, edgeThreshold *float64, sigma *float64) SIFT { |
features2d.go
Outdated
numSigma = *sigma | ||
} | ||
|
||
return SIFT{p: unsafe.Pointer(C.SIFT_CreateCustom(C.int(numFeatures), C.int(numOctaveLayers), C.double(numContrastThreshold), C.double(numEdgeThreshold), C.double(numSigma)))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return SIFT{p: unsafe.Pointer(C.SIFT_CreateCustom(C.int(numFeatures), C.int(numOctaveLayers), C.double(numContrastThreshold), C.double(numEdgeThreshold), C.double(numSigma)))} | |
return SIFT{p: unsafe.Pointer(C.SIFT_CreateWithParams(C.int(numFeatures), C.int(numOctaveLayers), C.double(numContrastThreshold), C.double(numEdgeThreshold), C.double(numSigma)))} |
features2d.h
Outdated
@@ -97,6 +97,7 @@ struct MultiDMatches FlannBasedMatcher_KnnMatch(FlannBasedMatcher f, Mat query, | |||
void DrawKeyPoints(Mat src, struct KeyPoints kp, Mat dst, const Scalar s, int flags); | |||
|
|||
SIFT SIFT_Create(); | |||
SIFT SIFT_CreateCustom(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIFT SIFT_CreateCustom(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma); | |
SIFT SIFT_CreateWithParams(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma); |
features2d.cpp
Outdated
@@ -590,6 +590,11 @@ SIFT SIFT_Create() { | |||
return new cv::Ptr<cv::SIFT>(cv::SIFT::create()); | |||
} | |||
|
|||
SIFT SIFT_CreateCustom(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIFT SIFT_CreateCustom(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma) { | |
SIFT SIFT_CreateWithParams(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma) { |
Hello @carpino please see my suggested changes inline. See https://github.com/hybridgroup/gocv/blob/release/CONTRIBUTING.md#how-to-add-a-function-from-opencv-to-gocv for some explanation. Also, can you please add a smoke test as described in the contribution guidelines? Thank you! |
Hi @deadprogram, thanks for the quick response, changed the name according to your suggestion and contribution guidelines, added smoke test that follow the structure of the test for SIFT without params, checking the correct number of features, generally I should check for a number of features not greater than the params but for the image used in the test SIFT extract an higher number of features if created without params, so I check an inequality |
Thanks for the addition @carpino now squash/merging. |
Hello,
ive crearted a procedure to instantiate a SIFT object with custom values,
ive created a new procedure leaving untouched the default unparametrized procedure,
hope this will be included in the dev branch,
(ive closed the pull request just created in the wrong branch)
@deadprogram