mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
opencv_version: dump detected HW features
This commit is contained in:
parent
01f4a173ab
commit
c8930cc279
@ -20,6 +20,7 @@ int main(int argc, const char** argv)
|
||||
"{ help h usage ? | | show this help message }"
|
||||
"{ verbose v | | show build configuration log }"
|
||||
"{ opencl | | show information about OpenCL (available platforms/devices, default selected device) }"
|
||||
"{ hw | | show detected HW features (see cv::checkHardwareSupport() function). Use --hw=0 to show available features only }"
|
||||
);
|
||||
|
||||
if (parser.has("help"))
|
||||
@ -42,5 +43,26 @@ int main(int argc, const char** argv)
|
||||
cv::dumpOpenCLInformation();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -427,6 +427,12 @@ in OpenCV.
|
||||
*/
|
||||
CV_EXPORTS_W bool checkHardwareSupport(int feature);
|
||||
|
||||
/** @brief Returns feature name by ID
|
||||
|
||||
Returns empty string if feature is not defined
|
||||
*/
|
||||
CV_EXPORTS_W String getHardwareFeatureName(int feature);
|
||||
|
||||
/** @brief Returns the number of logical CPUs available for the process.
|
||||
*/
|
||||
CV_EXPORTS_W int getNumberOfCPUs();
|
||||
|
@ -663,6 +663,11 @@ bool checkHardwareSupport(int feature)
|
||||
return currentFeatures->have[feature];
|
||||
}
|
||||
|
||||
String getHardwareFeatureName(int feature)
|
||||
{
|
||||
const char* name = getHWFeatureName(feature);
|
||||
return name ? String(name) : String();
|
||||
}
|
||||
|
||||
volatile bool useOptimizedFlag = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user