main.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
// C++ program for the above approach #include <iostream> #include <opencv2/opencv.hpp> using namespace cv; using namespace std; // Driver code int main(int argc, char** argv) { // Read the image file as // imread("default.jpg"); Mat image = imread("Enter the Address" "of Input Image", IMREAD_GRAYSCALE); // Error Handling if (image.empty()) { cout << "Image File " << "Not Found" << endl; // wait for any key press cin.get(); return -1; } // Show Image inside a window with // the name provided imshow("Window Name", image); // Wait for any keystroke waitKey(0); return 0; } |