Introduction - If you have any usage issues, please Google them yourself
*** *** ***
CImg CImg::operator+ (CImg gray)
功能:图像按位加
参数:
CImg 对象
返回值:
CImg 相加后的 CImg 类图像对象
******************
CImg CImg::operator+ (CImg gray)
{
CImg grayRet //返回图像
grayRet *this
//取得图像的高和宽
int nHeight GetHeight()
int nWidth GetWidthPixel()
int i, j //循环变量
//不能在CImg类对象中直接进行像素相加,因为相加的结果可能超过255
vector< vector<int> > GrayMat //求和后暂存图像的灰度点阵
vector<int> vecRow(nWidth, 0) //GrayMat中的一行(初始化为0)
for(i 0 i<nHeight i++)
{
GrayMat.push_back(vecRow)
}