OpenCV installation on windows - windows

I'm trying to install OpenCV on Windows and I followed the Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1) tutorial from the official OpenCV documentation but when I run the build operation I get an error.
I'm using:
Windows 10
CMake 3.9.1
Git Bash 2.17.0
TDM64 GCC compiler 5.1.0
Here's the error
In file included from C:\lib\opencv\modules\videoio\src\cap_msmf.cpp:59:0:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/mfplay.h:77:50: error: 'MFP_MEDIAITEM_CHARACTERISTICS' has not been declared
STDMETHOD_(HRESULT,GetCharacteristics)(THIS_ MFP_MEDIAITEM_CHARACTERISTICS *pCharacteristics) PURE;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/mfplay.h:79:46: error: 'IMFPMediaPlayer' has not been declared
STDMETHOD_(HRESULT,GetMediaPlayer)(THIS_ IMFPMediaPlayer **ppMediaPlayer) PURE;
Did someone encounter this kind of error?

Yes I also encountered this error (when compiling with MinGW-w64 gcc 8.1).
For you and anybody else who finds this question when this error occurs (like me), here's what solved the issue for me:
When not using Visual Studio, you have to disable some features which are not supported. Build with cmake options WITH_IPP=OFF and WITH_MSMF=OFF
Solution found on opencv answers: http://answers.opencv.org/question/192758/compile-error-when-compiling-for-windows-341-dev/

Related

clang: error: invalid version number in '-mmacosx-version-min=11.2'

I am currently on Mac OSX Big Sur 11.2.3. Whenever I run the command:
g++-10 -o project0 project0.cpp -lm -fopenmp
I get the following error:
clang: error: invalid version number in '-mmacosx-version-min=11.2'
I realized that this may be due to the fact that I'm on Big Sur 11.2.3 but I was told that this should not be an issue. I've tried many things already such as reinstalling gcc doing brew install gcc and so forth to no avail. At this point, I'm very unsure on what to do. Any help would be very much appreciated!
I ran into the same problem while trying to install fiona. You are correct it is due to Big Sur, as you can see in this article
Follow it and it should sort out the issue. Note, I had to uninstall Command Line tools and re-install it as outlined in this answer.
I ran into a similar issue when I tried to compile a library with clang-9 on an up-to-date system, with clang-9 installed via homebrew:
clang-9: error: invalid version number in '-mmacosx-version-min=12.6'
Updating xcode command line tools doesn't help here, since I actually want / have to use the old compiler. Setting the following environment variable for the build solved the issue:
export SYSTEM_VERSION_COMPAT=1

Homebrew doesn't install GCC correctly

I recently upgraded xcode command line tools to version 2384. After this I decided to reinstall gcc which was installed with homebrew. Installation completed with no errors but when I tried to compile a simple code with iostream library, it gave an error saying:
/usr/local/Cellar/gcc/10.2.0/include/c++/10.2.0/cwchar:44:10: fatal error: wchar.h: No such file or directory
Later, I checked the library folder and there were multiple files missing such as assert.h. I want to ask is there any way to fix this other than installing every file one by one? I already tried updating homebrew and xcode command line tools.

Compiling OpenCV 3.0.0 for Python 2.7.11 on Windows

I am trying to compile my own opencv 3.0.0 from source for Python 2.7.11. I find this messages. These messages appear in CMAKE.
Could NOT find PythonInterp: Found unsuitable version "2.7.11", but required is at least "3.4" (found C:/Python27/python.exe)
Could NOT find PythonInterp: Found unsuitable version "2.7.11", but required is at least "3.2" (found C:/Python27/python.exe)
And after I made the compile the first time I didn't find the Python directory that should include cv2.pyd.
Also I get this error messsage when I check the opencv_dnn_BUILD_TORCH_IMPORTER.
CMake Error at C:/opencv3/sources/opencv_contrib/modules/dnn/CMakeLists.txt:57 (message):
OPENCV_TEST_DATA_PATH environment variable was not specified
Can I find any source that has the steps of compiling opencv for Python 2.7.x on a Windows machine
By trying to install OpenCV from source on a Windows machine you are taking on a very large task. I would strongly recommend installing from the prebuilt packages available from OpenCV's website - and I'm also recommend going straight for OpenCV 3.1 rather than 3.0. You can get that install file here: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.1.0/opencv-3.1.0.exe/download
With that said, if you still want to install from source you can get all the instructions to do this in Windows here: http://docs.opencv.org/3.0-beta/doc/tutorials/introduction/windows_install/windows_install.html
Good luck, and happy coding!

ccmake. in cygwin & Windows 7 (64bit)

I have only used Mac in the past to compile, so I am a little lost with the following issue.
I am trying to compile a program in Windows 7 through cygwin. Svn co to get the source code works, but upon $ ccmake. the error "command not found" appears. I have the devel. tools from the cygwin setup, as well as cmake and MinGW-64 installed. Where can be the bug? Is ccmake. command supported at all in cygwin?
Any hints are appreciated.
If you are using Cygwin, you should install Cmake using Cygwin as well. The package should be called "cmake". Once that is done you should find ccmake at
/usr/bin/ccmake
AKA
C:\cygwin\bin\ccmake.exe
and you should make sure your PATH contains /usr/bin
ref

CMake Xcode generator uses no longer supported options

I'm trying to make a Xcode project from the Insight Toolkit (ITK, itk.org). I issued the following command into the terminal:
ccmake -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DCMAKE_CXX_COMPILER=/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -GXcode /<path to source>
When I try to generate the project it fails with this error:
CMake Error at /Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "/Applications/Xcode.app/Contents/Developer/usr/bin/gcc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /<path to destination folder>/CMakeFiles/CMakeTmp
Run Build Command:/Applications/CMake\ 2.8-7.app/Contents/bin/cmakexbuild -project CMAKE_TRY_COMPILE.xcode build -target cmTryCompileExec -buildstyle Development
xcodebuild: error: option '-buildstyle' is no longer supported
How can I configure the call to cmakexbuild? I haven't found a respective entry in the CMake configuration menu.
I have found similar problems from other users with other projects so I assume it's a problem with the CMake configuration.
I'm using Xcode 4.3 and CMake 2.8.7 on Mac OS X Lion 10.7.3.
Thanks for your help,
Paul
It's a CMake bug and it seem to be been fixed in development version:
http://public.kitware.com/Bug/view.php?id=12621
You can fix this by telling OSX which version of Xcode you want to use. If you installed 4.3, it has moved to the Apps folder, along with all the tools. Previously they were all in /Developer. Do the following and try again.
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
You may also have to install the command-line tools. I already installed these so I don't know what will happen without them.
cmake 2.8.8 rc1 is out now. Perhaps try that. I think it has solved my problem. :)

Resources