Created
December 6, 2017 21:59
-
-
Save reinaldorauch/8bb0dfa27738f42a7d09e4818ed24839 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat invertImage(Mat image) { | |
Vec3b p; | |
for (int i = 0; i < image.rows; ++i) | |
{ | |
for (int j = 0; j < image.cols; ++j) | |
{ | |
p = image.at<Vec3b>(i, j); | |
image.at<Vec3b>(i, j)[0] = 255 - p[0]; | |
image.at<Vec3b>(i, j)[1] = 255 - p[1]; | |
image.at<Vec3b>(i, j)[2] = 255 - p[2]; | |
} | |
} | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment