我想在研究中使用github上bgslibrary文件夹中的wrapper_matlab文件。
我遵循了自述中提到的步骤,但在运行compile.m
时出现了错误。
我已经安装了Microsoft Visual Studio 2015,我正在使用matlab 2018a。
摘要输出为:
Building with 'Microsoft Visual C++ 2015'.
cl /c /Zp8 /GR /W3 /EHs /nologo /MD /O2 /Oy- /DNDEBUG /DMEX_COMPILE_FLAG /DMATLAB_DEFAULT_RELEASE=R2017b /DUSE_MEX_CMD /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE -I"C:Program FilesMATLABR2018atoolboxvisionbuiltinssrcocvcgopencvinclude" -I"C:Program FilesMATLABR2018aexterninclude" -I"C:Program FilesMATLABR2018atoolboxdistcompgpuexterninclude" -I"..package_bgs" -I"C:Program FilesMATLABR2018aexterninclude" -I"C:Program FilesMATLABR2018asimulinkinclude" "E:BAWstudydoctoralbgslibrary-masterwrapper_matlabbackgroundSubtractor_wrapper.cpp" /FoC:UsersihssaneAppDataLocalTempmex_62234284571999_12516backgroundSubtractor_wrapper.obj
Error using mexOpenCV (line 136)
backgroundSubtractor_wrapper.cpp
e:bawstudydoctoralbgslibrary-masterwrapper_matlabmxarray.h(591): warning C4267: 'argument': conversion from 'size_t' to
'int', possible loss of data
E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include/opencv2/imgproc/types_c.h(58): error
C2011: 'CvConnectedComp': 'struct' type redefinition
....
...
....
C:Program FilesMATLABR2018atoolboxvisionbuiltinssrcocvcgopencvincludeopencv2/imgproc/types_c.h(222): note: see
declaration of 'CV_Luv2LBGR'
E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include/opencv2/imgproc/types_c.h(223): error
C2365: 'CV_Luv2LRGB': redefinition; previous definition was 'enumerator'
C:Program FilesMATLABR2018atoolboxvisionbuiltinssrcocvcgopencvincludeopencv2/imgproc/types_c.h(223): note: see
declaration of 'CV_Luv2LRGB'
E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include/opencv2/imgproc/types_c.h(223): fatal
error C1003: error count exceeds 100; stopping compilation
Error in compile (line 3)
mexOpenCV -v -DMEX_COMPILE_FLAG -I"../package_bgs" backgroundSubtractor_wrapper.cpp ...
看起来您可能有两个不同版本的OpenCV的头。此:
C:Program FilesMATLABR2018atoolboxvisionbuiltinssrcocvcgopencvinclude
这个:
E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include
两者看起来都像OpenCV头文件的路径。您应该尝试从构建中删除其中一个。