Comments (4)
Keeping the same patterns as used by the other wrappers is the best bet. But I see from the PR that you already also came to that same conclusion 😸
Thanks for working on this @Cartermel
from gocv.
I noticed the keypoints are being copied back over to c++ in a couple of functions:
Line 765 in e2db8f8
Line 843 in e2db8f8
Should be trivial to implement for BRIEF, I was originally worried about the performance impact of copying the keypoints since, for my use case at least, I'll be running this against thousands of images. But I ran some benchmarks and copying the struct between c++ / go is extremely lightweight, which makes sense since the keypoint struct is very small.
Here's some data for anyone curious:
(I only used time.Now() and time.Since() for measuring elapsed, there's probably a better way but I didn't search)
elapsed times are the average of 3 runs rounded to nearest 100ms
5000 iterations:
No copy: 26200ms
Copy: 27800ms
No copy 1600ms faster
~5.9% difference
10000 iterations:
No copy: 52000ms
Copy: 55400ms
No copy 3400ms faster
~6.3% difference
This was using this function for computing the descriptors using BRIEF and copying from go (my vscode syntax highlighting is broken...) :
Where VectorOfKeyPoint is a custom struct that's just a ptr to a vectorcv::KeyPoint for testing. And the c++ implementation was:
And the native c++ implementation without copying was this:
Where I passed in the same FastFeatureDector from golang. Not shown is the code for creating the BriefDescriptorExtractor, but its the same as all the other feature2d alg initialization.
This is running on a Ryzen 7 5800X.
TLDR
Copying the keypoints from golang for use in BRIEF results in about a 6% time loss (on my minimal testing), but leaves all the existing keypoint implementation intact. Personally I think this is a fine trade off, I'm interested in knowing what everyone thinks!
In the meantime I'll create a PR for BRIEF and copy the golang keypoints, unless someone's currently building this!
from gocv.
Forgot to add, this was the simple benchmark function:
and the native c++ call was basically exactly the same but with the c call.
And it just uses the lenna photo from opencv.
from gocv.
Released as part of 0.36 so now closing. Thank you!
from gocv.
Related Issues (20)
- How to parse blob?
- Memory leak in ORB detector
- triangulatePoints
- Error installing OpenCV libtbb2 and libdc1394-22-dev not found HOT 1
- Issue using gocv 0.35.0 in combination with opencv 4.8.1 in docker HOT 1
- Update to Support Additional Fonts from HersheyFont HOT 1
- MinMaxIdx function does not return the correct index. HOT 2
- BoxPoints, MinAreaRect inconsistent with C++ version of OpenCV, causing precision issues HOT 2
- Why is Mat used for in Range instead of a scalar wit hsv? And how can I sat Mat to a lower HSV range? HOT 2
- Consider adding VideoWriterFileWithAPI?
- Compilation yields "/bin/sh: line 0: cd: OLDPWD not set" on MacOS HOT 2
- Severe Memory Leak During Conversion between Image and gocv.Mat HOT 1
- go run . doesn't work on macos sonoma 14.2.1 (23C71) HOT 3
- Missing ArUco when installing OpenCV Debian Repository HOT 2
- building a static binary with ` gocv/opencv:4.9.0-static` fails HOT 3
- Not able to run simple example HOT 1
- Skew Correction
- Unable to complete install with CUDA (make install_cuda) HOT 3
- make install BUILD_SHARED_LIBS=OFF fails on Ubuntu 22.04 HOT 1
- windows error: invalid cast from type 'pthread_t' {aka 'ptw32_handle_t'} to type 'void* HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gocv.