//使得rect区域半透明 Mat translucence(Mat src,Rect rect,int idepth){ Mat dst = src.clone(); Mat roi = dst(rect); roi += cv::Scalar(idepth,idepth,idepth); return dst; } 将选择的区域打上变成半透明.虽然这只是一个简单的函数,但是使用起来灵活多变. 比如说,可以将图
图像增强是图像处理的第一步.这里集成了一些实际使用过程中有用的函数. //读取灰度或彩色图片到灰度 Mat imread2gray(string path){ Mat src = imread(path); Mat srcClone = src.clone(); if (CV_8UC3 == srcClone.type() ) cvtColor(srcClone,srcClone,CV_BGR2GRAY);