Reputation: 759
I want to write a c++ code that can be build both in opencv version 3 and 4. But I found that CV_BGR2RGB
in v3 is moved to COLOR_BGR2RGB
in v4. I need that for an argument of cvtColor
function.
In that case, how can I make it work in both version?
Upvotes: 0
Views: 769
Reputation: 1927
Simple:
#include "opencv2/imgproc/imgproc_c.h"
Complex:
#if (CV_VERSION_MAJOR >= 4)
cv::cvtColor(..., cv::COLOR_BGR2RGB);
#else
cv::cvtColor(..., CV_BGR2RGB);
#endif
Upvotes: 2