GithubHelp home page GithubHelp logo

Comments (3)

lxxue avatar lxxue commented on July 27, 2024

Hi, the author creates a new database (also overwrites the old one as they have the same name) and go over the correspondences as shown here:

Database database(database_path_ + "/database.db");
images = database.ReadAllImages();
for (std::vector<Image>::iterator it = images.begin(); it != images.end();
++it) {
image_names.push_back(it->Name());
}
std::sort(image_names.begin(), image_names.end());
CorrespondenceGraph sg = database_cache->CorrespondenceGraph();
for (auto const &im1 : image_names) {
std::map<std::string, float> im1_aam_map;
for (auto const &im2 : image_names) {
if (im1.compare(im2) == 0) {
im1_aam_map.insert(std::make_pair(im2, 0.0));
} else if (im1.compare(im2) > 0) {
im1_aam_map.insert(std::make_pair(
im2, aam_distances_map.find(im2)->second.find(im1)->second));
} else {
Image im1_ = database.ReadImageWithName(im1);
Image im2_ = database.ReadImageWithName(im2);
if (!sg.ExistsImage(im1_.ImageId()) ||
!sg.ExistsImage(im2_.ImageId())) {
continue;
}
colmap::FeatureMatches correspondences =
sg.FindCorrespondencesBetweenImages(im1_.ImageId(), im2_.ImageId());
colmap::FeatureMatches::iterator correspondence_itr;
double aam_matches = 0.0;
for (correspondence_itr = correspondences.begin();
correspondence_itr != correspondences.end();
++correspondence_itr) {
std::vector<CorrespondenceGraph::Correspondence>
point_correspondences = sg.FindCorrespondences(
im1_.ImageId(), (*correspondence_itr).point2D_idx1);
if (!sg.HasCorrespondences(im1_.ImageId(),
(*correspondence_itr).point2D_idx1)) {
continue;
}
if (!sg.HasCorrespondences(im2_.ImageId(),
(*correspondence_itr).point2D_idx2)) {
continue;
}
// tuned parameters
// aam_matches += pow(0.5, point_correspondences.size() - 1);
aam_matches += pow(0.3, point_correspondences.size() - 1);
}
im1_aam_map.insert(std::make_pair(im2, 1.0 / (aam_matches + 0.000001)));
}
}
aam_distances_map.insert(std::make_pair(im1, im1_aam_map));
}
std::cout
<< "******************************************************** Finished "
"Initializing MDS ************************************************"
<< std::endl;
}

I think the matches are in the DatabaseCache and not computed from scratch again.

from sfm-disambiguation-colmap.

coder12333444 avatar coder12333444 commented on July 27, 2024

@lxxue
Hi,
if creates a new database,the " images = database.ReadAllImages(); " images.size ==0,then image_names.size ==0;the for (auto const &im1 : image_names) do not exec ,so I think the database.db is the result of image extracting and image matching,do you think?

from sfm-disambiguation-colmap.

lxxue avatar lxxue commented on July 27, 2024

Sorry for the wrong answer: "the author creates a new database (also overwrites the old one".

Yes, you are right the author didn't create a new database. They just use the matches from database.db.

from sfm-disambiguation-colmap.

Related Issues (5)

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.