Description
- OpenCV => 4.3
- Operating System / Platform => Windows 64-bit
- Compiler => VS2017
Detailed description
Compiling the latest head on master with HAVE_EIGEN on VS2017 results in an incomplete build.
Steps to reproduce
cmake -A x64 -DWITH_EIGEN=true ../
imgproc module will fail to build. There are multiple issues that arise during the build. The first issue is the use of windows min() / max() definitions. This interferes with existing definitions from openCV.
--- a/modules/core/include/opencv2/core/private.hpp
+++ b/modules/core/include/opencv2/core/private.hpp
@@ -67,6 +67,7 @@
# pragma warning(disable:4702) // unreachable code
# pragma warning(disable:4714) // const marked as __forceinline not inlined
# endif
+# define NOMINMAX
# include <Eigen/Core>
# if defined(_MSC_VER)
# pragma warning(pop)
The second issue is the variable definition in color_yuv.simd.hpp as well as the use of a windows defined scrollbar macro, scr1 from dlgs.h.
--- a/modules/imgproc/src/color_yuv.simd.hpp
+++ b/modules/imgproc/src/color_yuv.simd.hpp
@@ -42,7 +42,8 @@ void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
int width, int height,
int dcn, bool swapBlue, int uIdx, int ycn);
-#ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
+//#ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
+#if 1
#if defined(CV_CPU_BASELINE_MODE)
// included in color.hpp
@@ -347,7 +348,11 @@ struct RGB2YCrCb_i<ushort>
sr0 = sr0 - sy0; sr1 = sr1 - sy1;
sb0 = sb0 - sy0; sb1 = sb1 - sy1;
- v_int32 scr0, scr1, scb0, scb1;
+ #undef scr1
+ v_int32 scr0;
+ v_int32 scr1;
+ v_int32 scb0;
+ v_int32 scb1;
scr0 = (sr0*vc3 + vdd) >> shift;
scr1 = (sr1*vc3 + vdd) >> shift;
There's one additional issue that I've hacked around that can be seen above. The define CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY is defined in cv_cpu_include_simd_declarations.hpp. The presence of this macro definition prevents the code in color_yuv.simd.hpp from being compiled, leaving a lot of undefined symbols. I'm not quite sure how to resolve this issue as removing the CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY define causes more issues with other parts of imgproc.