2016-09-14 14:22:54 +08:00
|
|
|
// This file is part of OpenCV project.
|
|
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <opencv2/core.hpp>
|
2017-05-25 23:59:01 +08:00
|
|
|
#include <opencv2/core/utils/trace.hpp>
|
2016-09-14 14:22:54 +08:00
|
|
|
|
2018-01-27 21:09:28 +08:00
|
|
|
#include <opencv2/core/opencl/opencl_info.hpp>
|
|
|
|
|
2016-09-14 14:22:54 +08:00
|
|
|
int main(int argc, const char** argv)
|
|
|
|
{
|
2017-05-25 23:59:01 +08:00
|
|
|
CV_TRACE_FUNCTION();
|
|
|
|
CV_TRACE_ARG(argc);
|
|
|
|
CV_TRACE_ARG_VALUE(argv0, "argv0", argv[0]);
|
|
|
|
CV_TRACE_ARG_VALUE(argv1, "argv1", argv[1]);
|
|
|
|
|
2016-09-14 14:22:54 +08:00
|
|
|
cv::CommandLineParser parser(argc, argv,
|
|
|
|
"{ help h usage ? | | show this help message }"
|
|
|
|
"{ verbose v | | show build configuration log }"
|
2018-01-27 21:09:28 +08:00
|
|
|
"{ opencl | | show information about OpenCL (available platforms/devices, default selected device) }"
|
2018-01-27 21:37:38 +08:00
|
|
|
"{ hw | | show detected HW features (see cv::checkHardwareSupport() function). Use --hw=0 to show available features only }"
|
2016-09-14 14:22:54 +08:00
|
|
|
);
|
2018-01-27 21:09:28 +08:00
|
|
|
|
2016-09-14 14:22:54 +08:00
|
|
|
if (parser.has("help"))
|
|
|
|
{
|
|
|
|
parser.printMessage();
|
2018-01-27 21:09:28 +08:00
|
|
|
return 0;
|
2016-09-14 14:22:54 +08:00
|
|
|
}
|
2018-01-27 21:09:28 +08:00
|
|
|
|
|
|
|
if (parser.has("verbose"))
|
2016-09-14 14:22:54 +08:00
|
|
|
{
|
|
|
|
std::cout << cv::getBuildInformation().c_str() << std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cout << CV_VERSION << std::endl;
|
|
|
|
}
|
2018-01-27 21:09:28 +08:00
|
|
|
|
|
|
|
if (parser.has("opencl"))
|
|
|
|
{
|
|
|
|
cv::dumpOpenCLInformation();
|
|
|
|
}
|
|
|
|
|
2018-01-27 21:37:38 +08:00
|
|
|
if (parser.has("hw"))
|
|
|
|
{
|
|
|
|
bool showAll = parser.get<bool>("hw");
|
|
|
|
std::cout << "OpenCV's HW features list:" << std::endl;
|
|
|
|
int count = 0;
|
|
|
|
for (int i = 0; i < CV_HARDWARE_MAX_FEATURE; i++)
|
|
|
|
{
|
|
|
|
cv::String name = cv::getHardwareFeatureName(i);
|
|
|
|
if (name.empty())
|
|
|
|
continue;
|
|
|
|
bool enabled = cv::checkHardwareSupport(i);
|
|
|
|
if (enabled)
|
|
|
|
count++;
|
|
|
|
if (enabled || showAll)
|
|
|
|
{
|
|
|
|
printf(" ID=%3d (%s) -> %s\n", i, name.c_str(), enabled ? "ON" : "N/A");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::cout << "Total available: " << count << std::endl;
|
|
|
|
}
|
|
|
|
|
2016-09-14 14:22:54 +08:00
|
|
|
return 0;
|
|
|
|
}
|