mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 13:42:48 +00:00
拡張子の大文字小文字を無視するようにした
This commit is contained in:
parent
6989f81f4e
commit
22bbffe1d8
@ -2,12 +2,14 @@
|
||||
#include <windows.h>
|
||||
#include <Commctrl.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@ -233,7 +235,11 @@ private:
|
||||
tokenizer tokens(inputFileExt, sep);
|
||||
|
||||
for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter)
|
||||
extList.push_back("." + *tok_iter);
|
||||
{
|
||||
std::string ext(*tok_iter);
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||
extList.push_back("." + ext);
|
||||
}
|
||||
}
|
||||
|
||||
if (!NotSyncCropSize)
|
||||
@ -268,7 +274,12 @@ private:
|
||||
BOOST_FOREACH(const boost::filesystem::path& p, std::make_pair(boost::filesystem::recursive_directory_iterator(input_path),
|
||||
boost::filesystem::recursive_directory_iterator()))
|
||||
{
|
||||
if (!boost::filesystem::is_directory(p) && std::find(extList.begin(), extList.end(), p.extension().string()) != extList.end())
|
||||
|
||||
if (!boost::filesystem::is_directory(p))
|
||||
{
|
||||
std::string ext(p.extension().string());
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||
if (std::find(extList.begin(), extList.end(), ext) != extList.end())
|
||||
{
|
||||
auto mat = Waifu2x::LoadMat(p.string());
|
||||
if (mat.empty())
|
||||
@ -281,6 +292,7 @@ private:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto mat = Waifu2x::LoadMat(input_path.string());
|
||||
@ -376,7 +388,11 @@ private:
|
||||
BOOST_FOREACH(const boost::filesystem::path& p, std::make_pair(boost::filesystem::recursive_directory_iterator(path),
|
||||
boost::filesystem::recursive_directory_iterator()))
|
||||
{
|
||||
if (!boost::filesystem::is_directory(p) && std::find(extList.begin(), extList.end(), p.extension().string()) != extList.end())
|
||||
if (!boost::filesystem::is_directory(p))
|
||||
{
|
||||
std::string ext(p.extension().string());
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||
if (std::find(extList.begin(), extList.end(), ext) != extList.end())
|
||||
{
|
||||
const auto out_relative = relativePath(p, input_path);
|
||||
const auto out_absolute = output_path / out_relative;
|
||||
@ -386,6 +402,7 @@ private:
|
||||
file_paths.emplace_back(p.string(), out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include <tclap/CmdLine.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@ -179,7 +180,11 @@ int main(int argc, char** argv)
|
||||
tokenizer tokens(cmdInputFileExt.getValue(), sep);
|
||||
|
||||
for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter)
|
||||
extList.push_back("." + *tok_iter);
|
||||
{
|
||||
std::string ext(*tok_iter);
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||
extList.push_back("." + ext);
|
||||
}
|
||||
}
|
||||
|
||||
// 変換する画像の入力、出力パスを取得
|
||||
@ -202,7 +207,11 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (std::find(extList.begin(), extList.end(), p.extension().string()) != extList.end())
|
||||
else
|
||||
{
|
||||
std::string ext(p.extension().string());
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||
if (std::find(extList.begin(), extList.end(), ext) != extList.end())
|
||||
{
|
||||
const auto out_relative = relativePath(p, input_path);
|
||||
const auto out_absolute = output_path / out_relative;
|
||||
@ -212,6 +221,7 @@ int main(int argc, char** argv)
|
||||
file_paths.emplace_back(p.string(), out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user