Work on file types
This commit is contained in:
parent
840f6743f9
commit
5d5275bf25
16
example.cpp
16
example.cpp
|
@ -1,14 +1,30 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <opencv2/core.hpp>
|
#include <opencv2/core.hpp>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <filesystem> // C++17
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
string supportedExt[10] = {
|
||||||
|
".jpg", ".JPG",
|
||||||
|
".jpeg", ".JPEG",
|
||||||
|
".png", ".PNG",
|
||||||
|
".tif", ".TIF",
|
||||||
|
".tiff", ".tiff"
|
||||||
|
};
|
||||||
|
|
||||||
inline bool file_exists (const std::string& name) {
|
inline bool file_exists (const std::string& name) {
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
return (stat (name.c_str(), &buffer) == 0);
|
return (stat (name.c_str(), &buffer) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool is_image (const std::string& name) {
|
||||||
|
fs::path filePath = name;
|
||||||
|
if (filePath.extension() == ".jpg")
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue