- Download the installer from here MSYS2
- Follow the steps mentioned in the link above
- After installating, in the Windows search bar, type 'settings' to open your Windows Settings.
- Search for Edit environment variables for your account.
- Choose the Path variable and then select Edit, click new and paste
C:\msys64\mingw64\bin
if the installation is done at the default location. - Again click new and paste
C:\msys64\usr\bin
which is the path for make.exe - Select OK to save the updated PATH. You will need to reopen any console windows for the new PATH location to be available.
- Install from Binary distributions from here CMake
- Run the installer.
- When asked for, select “Add CMake to the system PATH for all users”.
- Complete the installation.
- Reopen any console windows for the new PATH location to be available.
OpenCV by default provides binaries to compile with visual studio which is available for download here
- Download OpenCV for windows from above link by downloading opencv-4.5.3-vc14_vc15.exe from the link above and extract it in C:\opencv
- Next download the source code (zip) from the same above link and extract in desired folder
- Inside the opencv-4.5.3 folder create a new folder named build.
- In command prompt navigate to the above directory and type
cmake -G "MSYS Makefiles" ..
- Next type
mingw32-make install
. This will take time to complete. - Once it has completed navigate to
C:\opencv-4.5.3\build\install\x64
and copy the folder mingw and paste it in the directoryC:\opencv\build\x64
where you can see vc14 and vc15 folders. - Now add
C:\opencv\build\x64
andC:\opencv\build\x64
to PATH by following the steps mentioned in the installation process for g++ and make - Reopen any console windows for the new PATH location to be available.
- Download the zip file named mingw provided in the repository and extract the folder inside
- Copy the folder mingw and paste it in the directory
C:\opencv\build\x64
where you can see vc14 and vc15 folders. - Follow steps 7 and 8 from above.
- Clone the repository using
git clone https://github.com/Abhishek-Nalawade/Installation-of-CMake-g-OpenCV-on-Windows
- Create build folder.
cd build
and typecmake -G "MSYS Makefiles" ..
- Next type
make
and after completion typeshell-app
. This should display the image if the installation was successfull. - If the image is displayed OpenCV is now ready to be used with any other desired C++ projects with MinGW on windows.