Download Visual Studio 2017: https://visualstudio.microsoft.com/downloads/
Download Cmake: https://cmake.org/download/
References:
https://github.com/opencv/opencv opencv-master
https://github.com/opencv/opencv_contrib contrib libraries
Download OpenCV from github site
then extract into a folder name Opencv-master:

then, using CMake to extract Opencv-master into a folder name
OpenCVGithub:


Then Configure => choose some other value like OpenGL,
OpenMP or un-tick in BUILD_JAVA
ð
Generate
Run OpenCV.sln from C:\Dev\Libraries\OpenCVGithub

From Solution Explorer part => Run ALL_BUILD for Debug
X64 and for RELEASE X64 (long time)
Then Run INSTALL for Debug X64 and for RELEASE X64 (faster)

Going to: View => Property Manager


Type env to find
Environment Variables from System Properties

Choose New – Var name: OPENCV_DIR with C:\Dev\Libraries\OpenCVGithub\install\x64\vc15

in Path: create two new paths: %OPENCV_DIR%\bin ; %OPENCV_DIR%\lib

Now open project and set up environment and library for the
project:

C/C++ - General: $(OPENCV_DIR)\..\..\include (% mean module, \.. turn back 1
directory)
Explain for \..\..
OPENCV_DIR: C:\Dev\Libraries\OpenCVGithub\install\x64\vc15
Include: C:\Dev\Libraries\OpenCVGithub\install\include

Linker – General:

Linker – Input:

opencv_core410.lib
opencv_core410d.lib
opencv_calib3d410.lib
opencv_calib3d410d.lib
opencv_datasets410.lib
opencv_datasets410d.lib
opencv_features2d410.lib
opencv_features2d410d.lib
opencv_highgui410.lib
opencv_highgui410d.lib
opencv_imgcodecs410.lib
opencv_imgcodecs410d.lib
opencv_imgproc410.lib
opencv_imgproc410d.lib
opencv_objdetect410.lib
opencv_objdetect410d.lib
opencv_plot410.lib
opencv_plot410d.lib
opencv_quality410.lib
opencv_quality410d.lib
opencv_rgbd410.lib
opencv_rgbd410d.lib
opencv_shape410.lib
opencv_shape410d.lib
opencv_stereo410.lib
opencv_stereo410d.lib
opencv_stitching410.lib
opencv_stitching410d.lib
opencv_surface_matching410.lib
opencv_surface_matching410d.lib
opencv_text410.lib
opencv_text410d.lib
opencv_tracking410.lib
opencv_tracking410d.lib
opencv_video410.lib
opencv_video410d.lib
opencv_videoio410.lib
opencv_videoio410d.lib
opencv_videostab410.lib
opencv_videostab410d.lib
opencv_xfeatures2d410.lib
opencv_xfeatures2d410d.lib
opencv_ximgproc410.lib
opencv_ximgproc410d.lib
opencv_xobjdetect410.lib
opencv_xobjdetect410d.lib
opencv_xphoto410.lib
opencv_xphoto410d.lib