Opencv imdecode save as grayscale settings

cv::Mat grayimage = cv::imread(buf,flag)

buf:arry type or vector of bytes

flag: IMREAD_GRAYSCALE (No matter which type is passed in, it will be saved as a grayscale image)

IMREAD_UNCHANGED (what type of picture is passed in, it will be saved as what type)

IMREAD_COLOR (no matter which type is passed in, it will be saved as a color map)

 

In addition: cv::cvtColor(source,dest,cv::COLOR_BGR2GRAY) converts grayscale image to color image

Guess you like

Origin blog.csdn.net/ynshi57/article/details/103190791