How to know if SSE2 is activated in opencv

[亡魂溺海] 提交于 2019-12-19 10:42:23

问题


I have a version of OpenCV 2.4.10 Library which was built for Intel X64 on Windows.

How can I know if the CV_SSE2 is active? I do not have the code. I just have the libs ,DLLs and headers.

Thanks


回答1:


You can check if SSE2 is enabled with the function checkHardwareSupport like:

#include <opencv2/opencv.hpp>
#include <iostream>

int main()
{
    cv::setUseOptimized(true); // Turn on optimization (if it was disabled)

    // Get other build information
    //std::cout << cv::getBuildInformation(); 

    // Check SSE2 support
    std::cout << cv::checkHardwareSupport(CV_CPU_SSE2);

    return 0;
}



回答2:


From the output of cv::getBuildInformation(), look for the line that says e.g. C++ flags (Release), if -msse2 is there in the list, that means software code of your version of OpenCV library is compiled with SSE2 build option enabled.
According to OpenCV's documentation, checkHardwareSupport() reports whether the feature is supported by the host hardware, which may not be the same as the compile option used to build the software, especially if your library is compiled by someone else on a different machine.



来源:https://stackoverflow.com/questions/32477403/how-to-know-if-sse2-is-activated-in-opencv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!