Invert and display an image

This commit is contained in:
mmcwilliams 2023-02-04 10:43:38 -05:00
parent 8f3616fca1
commit 3e15600268
1 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,5 @@
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <sys/stat.h>
#include <string>
#include <vector>
@ -35,6 +35,8 @@ inline bool is_image (const std::string& name)
int main(int argc, char** argv)
{
Mat image;
Mat inverted;
string input;
if (argc == 2) {
@ -59,6 +61,14 @@ int main(int argc, char** argv)
return -4;
}
image = imread(input);
bitwise_not(image, inverted);
imshow("Image", inverted);
waitKey(0);
destroyAllWindows();
cout << "Using image " << input << "." << endl;
return 0;