error: ‘CV_BGR2GRAY’ was not declared in this scope

某项目中opencv版本由opencv3更换为opencv4之后,之前的代码编译出错,

error: ‘CV_BGR2GRAY’ was not declared in this scope

这是由于版本更新,宏定义发生了改变。

修改方法为:将CV_BGR2GRAY改为cv::COLOR_BGR2GRAY

原文地址:https://www.cnblogs.com/cumtchw/p/13549249.html