Skip to content

Installation instructions Windows

Andrews Cordolino Sobral edited this page Mar 4, 2023 · 10 revisions

Windows installation

Requirements

  • OpenCV 2.4.x, 3.4.x, 4.x
  • Visual Studio 2013, 2015, 2017 or newer
  • CMake 3.12 or higher

How to compile on Windows 10 + MSVS2019 + OpenCV 3.4.7

  1. Open the Windows Command Prompt
  2. Run the following batch script:

Note that you may need to fix some paths related to your environment!

git clone --recursive https://github.com/andrewssobral/bgslibrary.git
cd bgslibrary

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

set OpenCV_DIR=C:\OpenCV\opencv-3.4.7\build
set BUILD_DIR=build_win_ocv347

set PATH=%PATH%;%OpenCV_DIR%\x64\vc15\bin
set PYTHONPATH=%PYTHONPATH%;%OpenCV_DIR%\python\cv2\python-3.7

if exist %BUILD_DIR% (
  echo Removing existing folder
  RMDIR /Q/S %BUILD_DIR%
)
mkdir %BUILD_DIR%
cd %BUILD_DIR%

cmake -DOpenCV_DIR=%OpenCV_DIR% -G "Visual Studio 16 2019" ..
:: If you want the Python Wrapper
:: cmake -DOpenCV_DIR=%OpenCV_DIR% -DBGS_PYTHON_SUPPORT=ON -DBGS_CORE_STATIC=ON -G "Visual Studio 16 2019" ..
:: The Python package will be generated at %BUILD_DIR%\pybgs.cp37-win_amd64.pyd
:: You also need to add it in your PYTHONPATH.

devenv bgslibrary.sln
cd ..
  1. Inside the MSVS2019 IDE you switch from Debug to Release and click on Build Solution (or CTRL + Shift + B)!

That's all!

Video tutorial

Compiling BGSLibrary with Python support on Windows 10 and MSVS 2017

Configuring and building BGSLibrary

Prebuilt binaries

Prebuilt binaries can be downloaded from the latest build for the following configurations: