Hello! I have a question. Why opencv for visual studio works almost 2 times faster than opencv for (mingw gcc)? How to fix it?

asked 2018-05-17 04:49:09 -0600

westKH gravatar image

updated 2018-05-18 07:38:53 -0600

The same code. Windows 7 x64; Intel Core i7-3612QM CPU 2.10 GHz (4 kernels 8 streams); RAM 8Gb; First example. VS 2017 OpenCV 3.4.0; Windows SDK version 10.0.16299.0 to target Windows 6.1.7601; The C compiler identification is MSVC 19.13.26131.1 Second example. The C compiler identification is GNU 7.3.0; Check for working C compiler: C: /msys64/mingw64/bin/gcc.exe; Found OpenCV: C: / msys64 / mingw64 (found version "3.4.0") In first example: time work for cv::matchTemplate(scene, img_templ, corr, CV_TM_CCORR_NORMED) ~= 0.6-0,7 s. In second example: time work for cv::matchTemplate(scene, img_templ, corr, CV_TM_CCORR_NORMED) ~= 1.1~1,4 s. I don't understand. Why is it different time? How does it fix?

edit retag flag offensive close merge delete

Comments

there are no facts in your question.

unless you point us at a specific situation (and come up with a reproducable example and numbers) -- we cannot help you.

berak gravatar imageberak ( 2018-05-17 05:04:39 -0600 )edit

The same code. Windows 7 x64; Intel Core i7-3612QM CPU 2.10 GHz (4 kernels 8 streams); RAM 8Gb; First example. VS 2017 OpenCV 3.4.0; Windows SDK version 10.0.16299.0 to target Windows 6.1.7601; The C compiler identification is MSVC 19.13.26131.1 Second example. The C compiler identification is GNU 7.3.0; Check for working C compiler: C: /msys64/mingw64/bin/gcc.exe; Found OpenCV: C: / msys64 / mingw64 (found version "3.4.0") In first example: time work for cv::matchTemplate(scene, img_templ, corr, CV_TM_CCORR_NORMED) ~= 0.6-0,7 s. In second example: time work for cv::matchTemplate(scene, img_templ, corr, CV_TM_CCORR_NORMED) ~= 1.1~1,4 s. I don't understand. Why is it different time? How does it fix?

westKH gravatar imagewestKH ( 2018-05-18 06:41:36 -0600 )edit
1

OpenCV includes a subset of Intel IPP. Probably with Visual Studio it is the IPP variant that is called.

OpenCV IPP is available on Windows, Mac and Linux. On Windows platform you should stick with Visual Studio in my opinion.

Eduardo gravatar imageEduardo ( 2018-05-18 08:06:03 -0600 )edit

@Eduardo , indeed, it is so (there is an ipp version for matchTemplate). and mingw can't link to ipp.

berak gravatar imageberak ( 2018-05-18 08:11:34 -0600 )edit

Thanks Eduardo. But I must use MinGW.

westKH gravatar imagewestKH ( 2018-05-22 04:19:42 -0600 )edit