Problem understanding OpenCV_DIR system variable


I have troubles understanding the meaning of the OpenCV_DIR system variable. I am following this tutorial OpenCV: Installation in Windows but it is not clear to me if this variable has to be set with my current OpenCV library build or if it will hold the location of the binaries where I will build my project? Could someone clarify?

The particular steps where this is mentioned are entitled " Set the OpenCV environment variable and add it to the systems path" it is on bottom of the tuttorial page.

In case it has to be set with a folder from my OpenCV library, why I don’t see such a folder?

Please help!

I think I got it it should be “C:\opencv-4.x\Build-4.x\install\x64\vc17” so it is where the binaries are.

No OPENCV_DIR is path whereyou installed opencv

and C:\install\opencv\x64\vc17\bin should be in PATH variable

Thank you, but I think I have set it correctly given the instructions on the tutorial and folder structure on my machine.

You are too funny.
You are right but you ask another question because PATH variable is not set
OPENCV_DIR is used by cmake not windows .
On Windows plugins must be linked with existing OpenCV build. Set OpenCV_DIR environment or CMake variable to the directory with OpenCVConfig.cmake file, it can be OpenCV build directory or some path in the location where you performed installation.

If you don’t use cmake you cannot see this message:
-- You might need to add C:\tmp\install\opencv\x64\vc17\bin to your PATH to be able to run your applications.

Yes, about the C:/install/***/bin path I also think that it should be added to the system Path variable. I got a problem running dlls.