cv::Mat inverseColor1(cv::Mat srcImage)
{
cv::Mat tempImage = srcImage.clone();
int row = tempImage.rows;
int col = tempImage.cols;
// 对各个像素点遍历进行取反
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
// 分别对各个通道进行反色处理
tempImage.at(i, j)[0] = 255 –
tempImage.at(i, j)[0];
tempImage.at(i, j)[1] = 255 –
tempImage.at(i, j)[1];
tempImage.at(i, j)[2] = 255 –
tempImage.at(i, j)[2];
}
}
return tempImage;
}
转载:http://blog.csdn.net/zhuwei1988