Download and install CMake GUI
Start CMake-gui, set paths to OpenCV's sources and destination directory and hit 'Configure'
When prompted for generator choose your version of Visual Studio and Win64, click 'Finish'
Check the 'BUILD_opencv_world ' checkbox
Set path to contrib sources under configuration option: OPENCV_EXTRA_MODULES_PATH
Path has to be set to 'modules' subdirectory !
Hit 'Configure' wait for message 'Configuring done', then hit 'Generate'. CMake should not pop any warnings. Wait for 'Generating done' message.
Navigate to output directory (build) and open solution.
In Visual Studio, set configuration to Debug
Right click on project 'ALL_BUILD' and choose 'Build'(this may take a while)
Then build project 'INSTALL' the same way.
Set configuration to Release
Right click on project 'ALL_BUILD' and choose 'Build' (this may take a while)
Then build project 'INSTALL' the same way.
Navigate to solution directory, resulting build is within 'install' directory.