Git Product home page Git Product logo

Comments (4)

griwodz avatar griwodz commented on September 17, 2024 1

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.

BruceXSK avatar BruceXSK commented on September 17, 2024

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.

gloria111 avatar gloria111 commented on September 17, 2024

it works,thanks

from popsift.

gloria111 avatar gloria111 commented on September 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.