gocv
gocv copied to clipboard
When I use win_build_opencv.cmd,I encountered some problems
When the script "mingw32-make install" "Building CXX object" it showed some trobles
Description
C:\opencv\build>mingw32-make install [ 0%] Built target opencv_dnn_plugins [ 0%] Built target opencv_highgui_plugins [ 0%] Built target gen-pkgconfig [ 1%] Built target jsimd [ 2%] Built target libopenjp2 [ 2%] Built target opencv_videoio_plugins [ 3%] Built target zlib [ 8%] Built target opencv_core [ 12%] Built target opencv_imgproc [ 14%] Built target libjpeg-turbo [ 16%] Built target libtiff [ 22%] Built target libwebp [ 27%] Built target IlmImf [ 28%] Built target libpng [ 29%] Built target opencv_imgcodecs [ 29%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_obsensor/obsensor_uvc_stream_channel.cpp.obj In file included from C:\opencv\opencv-4.8.1\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:41, from C:\opencv\opencv-4.8.1\modules\videoio\src\cap_obsensor\obsensor_uvc_stream_channel.cpp:33: C:\opencv\opencv-4.8.1\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr<IMFAttributes>': C:\opencv\opencv-4.8.1\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:145:42: required from here C:\opencv\opencv-4.8.1\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106:27: error: could not convert template argument 'cv::obsensor::ComPtr<IMFAttributes>::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr<IMFAttributes>::)()' {aka 'const GUID& (cv::obsensor::ComPtr<IMFAttributes>::)()'} to 'const IID& ()()' {aka 'const GUID& ()()'} 106 | _COM_SMARTPTR_TYPEDEF(T, __uuidof(T));
Your Environment
- Operating System and version: Win10
- OpenCV version used: nil
- How did you install OpenCV? no
- GoCV version used: 0.35.0
- Go version: 1.12.1
- Did you run the
env.sh
orenv.cmd
script before trying togo run
orgo build
? yes
I also cannot get it installed on Windows 11. It cannot find the header files, even though they are right there?
PS C:\Users\phili\SourceCode\goopencv> set CGO_CPPFLAGS="-IC:/Users/phili/SourceCode/opencv/build/include"
PS C:\Users\phili\SourceCode\goopencv> go run -tags customenv "C:\Users\phili\go\pkg\mod\gocv.io\x\[email protected]\cmd\version\main.go"
# gocv.io/x/gocv
In file included from aruco.cpp:1:0:
aruco.h:5:10: fatal error: opencv2/opencv.hpp: No such file or directory
#include <opencv2/opencv.hpp>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
PS C:\Users\phili\SourceCode\goopencv> dir C:\Users\phili\SourceCode\opencv\build\include\opencv2\opencv.hpp
Directory: C:\Users\phili\SourceCode\opencv\build\include\opencv2
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 9/27/2023 9:54 AM 3558 opencv.hpp
PS C:\Users\phili\SourceCode\goopencv>
I tried installing it in MSYS2 and got a different error:
phili@PhilBook3 UCRT64 ~/gocv
$ go run "C:\msys64\ucrt64\lib\go\pkg\mod\gocv.io\x\[email protected]\cmd\version\main.go"
# gocv.io/x/gocv
C:\Users\phili\go\pkg\mod\gocv.io\x\[email protected]\calib3d_string.go:3:9: undefined: CalibFlag
C:\Users\phili\go\pkg\mod\gocv.io\x\[email protected]\calib3d_string.go:29:9: undefined: CalibCBFlag
C:\Users\phili\go\pkg\mod\gocv.io\x\[email protected]\core_string.go:3:9: undefined: MatType
...
C:\Users\phili\go\pkg\mod\gocv.io\x\[email protected]\core_string.go:159:9: too many errors
I also cannot get it installed on Windows 11. It cannot find the header files, even though they are right there?
PS C:\Users\phili\SourceCode\goopencv> set CGO_CPPFLAGS="-IC:/Users/phili/SourceCode/opencv/build/include"
maybe use "\" instead of "/"
Building with "-DWITH_OBSENSOR=OFF" as suggested here fixed this issue for me.