/src/plugins/img_websearch/tests/test-surf-sim.cpp

https://github.com/sileht/debbot-seeks-experimental · C++ · 60 lines · 29 code · 10 blank · 21 comment · 1 complexity · 1ef62e554ba3e99ca995c8c6228214e7 MD5 · raw file

  1. /**
  2. * The Seeks proxy and plugin framework are part of the SEEKS project.
  3. * Copyright (C) 2010 Emmanuel Benazera, juban@free.fr
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include "ocvsurf.h"
  20. #include "highgui.h" // from OpenCV.
  21. #include <iostream>
  22. #include <stdlib.h>
  23. using namespace sp;
  24. using namespace seeks_plugins;
  25. int main(int argc, char **argv)
  26. {
  27. if (argc < 3)
  28. {
  29. std::cout << "Usage: <img1> <img2>\n";
  30. exit(0);
  31. }
  32. std::string img1 = std::string(argv[1]);
  33. std::string img2 = std::string(argv[2]);
  34. IplImage *img1_obj = cvLoadImage(img1.c_str(),CV_LOAD_IMAGE_GRAYSCALE);
  35. IplImage *img2_obj = cvLoadImage(img2.c_str(),CV_LOAD_IMAGE_GRAYSCALE);
  36. CvMemStorage* storage = cvCreateMemStorage(0);
  37. CvSeq *o1points = 0, *o1desc = 0;
  38. CvSeq *o2points = 0, *o2desc = 0;
  39. cvExtractSURF(img1_obj, 0, &o1points, &o1desc,
  40. storage, ocvsurf::_surf_params);
  41. cvExtractSURF(img2_obj, 0, &o2points, &o2desc,
  42. storage, ocvsurf::_surf_params);
  43. std::cout << "keypoints1 size: " << o1points->total << std::endl;
  44. std::cout << "descriptors1 size: " << o1desc->total << std::endl;
  45. std::cout << "keypoints2 size: " << o2points->total << std::endl;
  46. std::cout << "descriptors2 size: " << o2desc->total << std::endl;
  47. /* std::vector<surf_pair> ptpairs;
  48. ocvsurf::flannFindPairs(o1desc,o2desc,
  49. ptpairs); */
  50. }