查看 OpenCV 当前的指令集优化状态


#include "stdafx.h"

#include 
#include 

using namespace std;
using namespace cv;

int main()
{
    //设置是否启用指令集优化特性
    //cv::setUseOptimized(true);
    //获取当前机器的CPU指令集支持特性
    bool opt_status = cv::useOptimized();
    cout << "当前的指令集优化状态:" << opt_status << endl;
    //获取编译时配置
    cout << getBuildInformation() << endl;
    //检查硬件支持
    cout << "HardwareSupport:" << endl;
    cout << "CV_CPU_MMX: "    << checkHardwareSupport(CV_CPU_MMX) << endl;
    cout << "CV_CPU_SSE: "    << checkHardwareSupport(CV_CPU_SSE) << endl;
    cout << "CV_CPU_SSE2: "   << checkHardwareSupport(CV_CPU_SSE2) << endl;
    cout << "CV_CPU_SSE3: "   << checkHardwareSupport(CV_CPU_SSE3) << endl;
    cout << "CV_CPU_SSSE3: "  << checkHardwareSupport(CV_CPU_SSSE3) << endl;
    cout << "CV_CPU_SSE4_1: " << checkHardwareSupport(CV_CPU_SSE4_1) << endl;
    cout << "CV_CPU_SSE4_2: " << checkHardwareSupport(CV_CPU_SSE4_2) << endl;
    cout << "CV_CPU_POPCNT: " << checkHardwareSupport(CV_CPU_POPCNT) << endl;
    cout << "CV_CPU_FP16: "   << checkHardwareSupport(CV_CPU_FP16) << endl;
    cout << "CV_CPU_AVX: "    << checkHardwareSupport(CV_CPU_AVX) << endl;
    cout << "CV_CPU_AVX2: "   << checkHardwareSupport(CV_CPU_AVX2) << endl;
    cout << "CV_CPU_FMA3: "   << checkHardwareSupport(CV_CPU_FMA3) << endl;
    cout << "CV_CPU_AVX_512F: "   << checkHardwareSupport(CV_CPU_AVX_512F) << endl;
    cout << "CV_CPU_AVX_512BW: "  << checkHardwareSupport(CV_CPU_AVX_512BW) << endl;
    cout << "CV_CPU_AVX_512CD: "  << checkHardwareSupport(CV_CPU_AVX_512CD) << endl;
    cout << "CV_CPU_AVX_512DQ: "  << checkHardwareSupport(CV_CPU_AVX_512DQ) << endl;
    cout << "CV_CPU_AVX_512ER: "  << checkHardwareSupport(CV_CPU_AVX_512ER) << endl;
    cout << "CV_CPU_AVX_512IFMA512: "    << checkHardwareSupport(CV_CPU_AVX_512IFMA512) << endl;
    cout << "CV_CPU_AVX_512IFMA: " << checkHardwareSupport(CV_CPU_AVX_512IFMA) << endl;
    cout << "CV_CPU_AVX_512PF: "   << checkHardwareSupport(CV_CPU_AVX_512PF) << endl;
    cout << "CV_CPU_AVX_512VBMI: " << checkHardwareSupport(CV_CPU_AVX_512VBMI) << endl;
    cout << "CV_CPU_AVX_512VL: "   << checkHardwareSupport(CV_CPU_AVX_512VL) << endl;
    cout << "CV_CPU_NEON: "   << checkHardwareSupport(CV_CPU_NEON) << endl;
    cout << "CV_CPU_VSX: "    << checkHardwareSupport(CV_CPU_VSX) << endl;
    cout << "CV_CPU_AVX512_SKX: "  << checkHardwareSupport(CV_CPU_AVX512_SKX) << endl;
    cout << "CV_HARDWARE_MAX_FEATURE: " << checkHardwareSupport(CV_HARDWARE_MAX_FEATURE) << endl;
    return getchar();
}

Add Library: opencv_core.lib