gocv icon indicating copy to clipboard operation
gocv copied to clipboard

feature2d Calculate function missing

Open Maldris opened this issue 1 year ago • 2 comments

wanting to add support for the Calculate function from the feature2d interface

Description

I am migrating an application built by our teams data scientist from python to Go to run in our pipeline system. The application makes use of the feature2d detection and description algorithms (AKAZE, AGAST, BRISK, etc) and under some (thankfully rare) circumstances needs to use a different algorithm for detect and calculate, thus needing both functions available to call separately.

To make this possible I would need to add the Calculate function to each of the algorithms.

I wanted to check a few details, mostly related to preferred code style, and have this issue open to ensure work isn't duplicated and to act as a point for discussion of any items that come up during development or requests from the maintainers.

Queries

  1. I've assumed the preference is to implement the first overload variant rather than the second (as has been done for detect) https://docs.opencv.org/4.x/d0/d13/classcv_1_1Feature2D.html#ab3cce8d56f4fc5e1d530b5931e1e8dc0

  2. Is there a preference for function ordering in the .go , .h and .cpp files? i.e. calculate should always be before the relevant algo's detect function etc (i.e. calculate, detect, detectAndCalculate vs detect, detectAndCalculate then calculate vs others) or simply no preference so long as they are grouped together for each algorithm?

  3. given best practice is to call DetectAndCalculate where possible rather than Detect then Calculate, is there a recommendation for comments and/or annotations to highlight this to users who don't have a specific need to call them separately as in my motivating above.

  4. should an interface be created for the detector/descriptor algorithms as a helper for client applications that could take any, and also so that a type predicate can be added so future extensions will fail a build if the change accidentally makes them not satisfy the interface. i.e. var _ Detector = (*AKAZE)(nil)


I've created a fork for the project and I'll start experimenting to ensure I've understood the existing project structure correctly before proceeding further (also its been a few years since I've used C++ there may be some rust to shake off before making a final version).

Maldris avatar Jan 17 '23 01:01 Maldris