Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to find version of OpenCV

📅 2014-Mar-10 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

To print the version of OpenCV that you are using:

#include <opencv2/opencv.hpp>

std::cout << CV_VERSION << std::endl;

CV_VERSION is a macro that is defined in modules/core/include/opencv2/core/version.hpp as seen here. It combines the values of five definitions provided in the same file:

#define CV_VERSION_EPOCH    3
#define CV_VERSION_MAJOR    0
#define CV_VERSION_MINOR    0
#define CV_VERSION_REVISION 0
#define CV_VERSION_STATUS   "-dev"