#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <fstream>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
String fileName = "D:\\balik.jpg"; // by default
ifstream input(fileName);
if (input)
{
cout << "Ok! file exists...\n";
}
else
{
cout << "Oops! file not exists...\n";
return -1;
}
input.close(); //close file
Mat image;
image = imread(fileName, IMREAD_COLOR); // Read the file
if (image.empty()) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <fstream>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
String imageName("C:\\Users\\Emilia\\Desktop\\VS\\imageFolder\\image.jpg"); // by default
ifstream input(imageName);
if (input)
{
if (input)
{
cout << "Ok! file exists...\n";
}
else
{
cout << "Oops! file not exists...\n";
return -1;
}
}
input.close(); //закроем, мало ли
Mat image;
image = imread(imageName, IMREAD_COLOR); // Read the file
if (image.empty()) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}