最近写代码,使用到了CV_LOAD_IMAGE_GRAYSCALE,其为将原图转为灰度图片。如:
Mat srcImage = imread("srcImage.png", CV_LOAD_IMAGE_GRAYSCALE);
其转为灰度的计算公式为:
Gray = 0.299 * R + 0.587 * G + 0.114 * B
但在Opencv4中,CV_LOAD_IMAGE_GRAYSCALE却找不到,经过查看Opencv的API可知,CV_LOAD_IMAGE_GRAYSCALE已改为IMREAD_GRAYSCALE,如:
Mat srcImage = imread("srcImage.png", IMREAD_GRAYSCALE);