Invert and display an image
This commit is contained in:
parent
8f3616fca1
commit
3e15600268
12
example.cpp
12
example.cpp
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue