1 | initial version |
look a sample code below. for more information you can look here
#include "opencv2/imgcodecs.hpp"
#include <iostream>
using namespace cv;
static bool isFileExist( const String& filename )
{
/// Open the file
FILE* f= fopen( filename.c_str(), "rb" );
/// in the event of a failure, return false
if( !f )
return false;
fclose(f);
return true;
}
int main(int /*argc*/, char** /*argv*/)
{
Mat test = Mat::zeros(100, 100, CV_8UC1);
String filename = "test.jpg";
if( !isFileExist(filename))
imwrite(filename, test);
else std::cout << filename << " exist. not saved" << std::endl;
return 0;
}