You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure Visual Studio project to work with opencv
Go to the Visual Studio and create the new empty C++ project.
We will call it "HelloOpenCV".
Set the target to Debug and x64. This is very important to configure it for x64.
Paste the main.cpp code to the main.cpp
As we can see there is unknown include statement of the opencv package. We need to fix that.
For that we need to configure a project so that compiler could know where to take headers
and library from. Open the Project->HelloOpenCV Properties and go to VC++ Directories.
Change the Include Directories to contain corresponding include folder in the opencv
installation. Insert it to the beginning of the value: C:\opencv\opencv\build\include;
Change the Library directories to include C:\opencv\opencv\build\x64\vc15\lib
Change the Linker->Input->Additional dependencies to
include opencv_world451d.lib if we are talking about pre-configured package installation
include opencv_core451d.lib;opencv_highgui451d.lib;opencv_videoio451d.lib;opencv_imgcodecs451d.lib;
if we are talking about building from sources. In future, this list might be bigger
containing all the libraries and extensions that you use from opencv and opencv-contrib.
Apply and close the window
To name the few more available libraries that can be included with the following linker flags
(for Windows remove -l and add 451d.lib to the end if the version of opencv is 4.5.1:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Small correction for step 11: OPENCV_EXTRA_MODULES_PATH has to point to the "modules" sub-directory of the extracted files, otherwise you get the error "No modules has been found:" when configuring OpenCV.
I don't find bin folder in C:\opencv\bin but in C:\opencv\builds\bin and that folder only contain one file named opencv_videoio_ffmpeg481_64.dll. Is this the only file?
Thanks for sharing 🤝