mirror of
https://github.com/opencv/opencv.git
synced 2025-06-10 19:24:07 +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 }"
|
"{ help h usage ? | | show this help message }"
|
||||||
"{ verbose v | | show build configuration log }"
|
"{ verbose v | | show build configuration log }"
|
||||||
"{ opencl | | show information about OpenCL (available platforms/devices, default selected device) }"
|
"{ 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"))
|
if (parser.has("help"))
|
||||||
@ -42,5 +43,26 @@ int main(int argc, const char** argv)
|
|||||||
cv::dumpOpenCLInformation();
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -427,6 +427,12 @@ in OpenCV.
|
|||||||
*/
|
*/
|
||||||
CV_EXPORTS_W bool checkHardwareSupport(int feature);
|
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.
|
/** @brief Returns the number of logical CPUs available for the process.
|
||||||
*/
|
*/
|
||||||
CV_EXPORTS_W int getNumberOfCPUs();
|
CV_EXPORTS_W int getNumberOfCPUs();
|
||||||
|
@ -663,6 +663,11 @@ bool checkHardwareSupport(int feature)
|
|||||||
return currentFeatures->have[feature];
|
return currentFeatures->have[feature];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getHardwareFeatureName(int feature)
|
||||||
|
{
|
||||||
|
const char* name = getHWFeatureName(feature);
|
||||||
|
return name ? String(name) : String();
|
||||||
|
}
|
||||||
|
|
||||||
volatile bool useOptimizedFlag = true;
|
volatile bool useOptimizedFlag = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user