opencv_version.cpp 936 B

1234567891011121314151617181920212223242526272829303132
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html
  4. #include <opencv2/core/utility.hpp>
  5. #include <iostream>
  6. static const std::string keys = "{ b build | | print complete build info }"
  7. "{ h help | | print this help }";
  8. int main(int argc, const char* argv[])
  9. {
  10. cv::CommandLineParser parser(argc, argv, keys);
  11. parser.about("This sample outputs OpenCV version and build configuration.");
  12. if (parser.has("help"))
  13. {
  14. parser.printMessage();
  15. }
  16. else if (!parser.check())
  17. {
  18. parser.printErrors();
  19. }
  20. else if (parser.has("build"))
  21. {
  22. std::cout << cv::getBuildInformation() << std::endl;
  23. }
  24. else
  25. {
  26. std::cout << "Welcome to OpenCV " << CV_VERSION << std::endl;
  27. }
  28. return 0;
  29. }