Comments (4)
The FeaturesDev memory exists only in GPU memory, not in the CPU memory. To use the coordinates in the CPU after matching, you must transfer them first.
You could do something like this:
FeaturesHost* features = new FeaturesHost( lFeatures->getFeatureCount(), lFeatures->getDescriptorCount() );
features->pin( );
cudaMemcpy( features->getFeatures(),
lFeatures->getFeatures();
lFeatures->getFeatureCount() * sizeof(Feature),
cudaMemcpyDeviceToHost );
cudaMemcpy( features->getDescriptors(),
lFeatures->getDescriptors(),
lFeatures->getDescriptorCount() * sizeof(Descriptor),
cudaMemcpyDeviceToHost );
features->unpin( );
from popsift.
The FeaturesDev memory exists only in GPU memory, not in the CPU memory. To use the coordinates in the CPU after matching, you must transfer them first.
You could do something like this:
FeaturesHost* features = new FeaturesHost( lFeatures->getFeatureCount(), lFeatures->getDescriptorCount() ); features->pin( ); cudaMemcpy( features->getFeatures(), lFeatures->getFeatures(); lFeatures->getFeatureCount() * sizeof(Feature), cudaMemcpyDeviceToHost ); cudaMemcpy( features->getDescriptors(), lFeatures->getDescriptors(), lFeatures->getDescriptorCount() * sizeof(Descriptor), cudaMemcpyDeviceToHost ); features->unpin( );
I tried and it worked! Thank you so much!
from popsift.
it works,thanks
from popsift.
I try to get all the descriptors and feature points on the CPU with following codes
std::unique_ptr<popsift::Features> sf;
sf.reset(sfeatures);
popsift::Feature* sfeature_list = sf->getFeatures();
std::vector<float> spoints(4 * numFeatures);
std::vector<float> sdesc(128 * numFeatures);
int width = 1920;
int height = 1080;
for(size_t i = 0; i < numFeatures; i++) { popsift::Feature pFeat = sfeature_list[i];
but the program crashes when i try to print the descriptors.
cout << "pFeat.desc->features:" << ((pFeat.desc[0])->features[0[)<< endl;
for(int oriIdx = 0; oriIdx < pFeat.num_ori; oriIdx++)
{
const popsift::Descriptor* pDesc = pFeat.desc[oriIdx];
cout << "note here :" << ((pDesc->features)[0]) << endl;
for(int k = 0; k < 128; k++)
{
sdesc[128 * i + k] = pDesc->features[k]; //==(*pDesc).features[k]
}
spoints[4 * i + 0] = std::min<float>(std::round(pFeat.xpos), width - 1);
spoints[4 * i + 1] = std::min<float>(std::round(pFeat.ypos), height - 1);
spoints[4 * i + 2] = pFeat.sigma;
spoints[4 * i + 3] = pFeat.orientation[oriIdx];
}
}
from popsift.
Related Issues (20)
- Is popsift platform independent. HOT 2
- minor suggestions for code improvement HOT 5
- Could not get current device ID initialization error HOT 5
- [bug] Runtime HOT 6
- How to retrieve matches [question] HOT 3
- [question]how to get the xpos and ypos on the input image? HOT 2
- [question]how can I set config to extract the same features for same images? HOT 2
- [bug] s_filtergrid.cu does not compile missing thrust/host_vector.h header HOT 2
- [bug]cannot use thread_local specifier for a __constant__ variable ConsoleApplication1 E:\Desktop\VS-Test\09\ConsoleApplication1\popsift\gauss_filter.cu 21 HOT 2
- [request] using exception for error handling HOT 2
- Memory leak when running enqueue, job->get() in while loop HOT 9
- Doesn't build with cuda 12 HOT 1
- job->get() takes a long time(~200ms with default settings on a small image HOT 1
- [request] Support CUDA SDK 12.X HOT 1
- [ci] move ci to github actions HOT 1
- [request] Bringing PopSift implementation into OpenCV
- How to use popsift as API? HOT 3
- Cannot Reproduce OpenCV Descriptors
- [bug] PopSift build failure for CUDA >= 12.0 HOT 1
- [ci] Continuous integration for both Linux and Windows must be updated
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 popsift.