mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 13:42:48 +00:00
おすすめのCropSizeをcrop_size_list.txtから読み込むようにした
This commit is contained in:
parent
bdbab89bda
commit
64295f44db
@ -6,6 +6,8 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/tokenizer.hpp>
|
#include <boost/tokenizer.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
@ -26,6 +28,8 @@ const size_t AR_PATH_MAX(1024);
|
|||||||
const int MinCommonDivisor = 50;
|
const int MinCommonDivisor = 50;
|
||||||
const int DefaultCommonDivisor = 128;
|
const int DefaultCommonDivisor = 128;
|
||||||
|
|
||||||
|
const char * const CropSizeListName = "crop_size_list.txt";
|
||||||
|
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/10167382/boostfilesystem-get-relative-path
|
// http://stackoverflow.com/questions/10167382/boostfilesystem-get-relative-path
|
||||||
boost::filesystem::path relativePath(const boost::filesystem::path &path, const boost::filesystem::path &relative_to)
|
boost::filesystem::path relativePath(const boost::filesystem::path &path, const boost::filesystem::path &relative_to)
|
||||||
@ -93,6 +97,8 @@ class DialogEvent
|
|||||||
private:
|
private:
|
||||||
HWND dh;
|
HWND dh;
|
||||||
|
|
||||||
|
std::vector<int> CropSizeList;
|
||||||
|
|
||||||
std::string input_str;
|
std::string input_str;
|
||||||
std::string output_str;
|
std::string output_str;
|
||||||
std::string mode;
|
std::string mode;
|
||||||
@ -304,10 +310,10 @@ private:
|
|||||||
|
|
||||||
SendMessageA(hcrop, CB_ADDSTRING, 0, (LPARAM)"-----------------------");
|
SendMessageA(hcrop, CB_ADDSTRING, 0, (LPARAM)"-----------------------");
|
||||||
|
|
||||||
// 2の累乗を適当に追加していく
|
// CropSizeListの値を追加していく
|
||||||
for (int i = 64; i <= 512; i *= 2)
|
for (const auto n : CropSizeList)
|
||||||
{
|
{
|
||||||
std::string str(std::to_string(i));
|
std::string str(std::to_string(n));
|
||||||
SendMessageA(hcrop, CB_ADDSTRING, 0, (LPARAM)str.c_str());
|
SendMessageA(hcrop, CB_ADDSTRING, 0, (LPARAM)str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,6 +685,19 @@ public:
|
|||||||
SetWindowTextA(GetDlgItem(hWnd, IDC_EDIT_SCALE_RATIO), text);
|
SetWindowTextA(GetDlgItem(hWnd, IDC_EDIT_SCALE_RATIO), text);
|
||||||
SetWindowTextA(GetDlgItem(hWnd, IDC_EDIT_OUT_EXT), outputExt.c_str());
|
SetWindowTextA(GetDlgItem(hWnd, IDC_EDIT_OUT_EXT), outputExt.c_str());
|
||||||
SetWindowTextA(GetDlgItem(hWnd, IDC_EDIT_INPUT_EXT_LIST), inputFileExt.c_str());
|
SetWindowTextA(GetDlgItem(hWnd, IDC_EDIT_INPUT_EXT_LIST), inputFileExt.c_str());
|
||||||
|
|
||||||
|
std::ifstream ifs(CropSizeListName);
|
||||||
|
if (ifs)
|
||||||
|
{
|
||||||
|
std::string str;
|
||||||
|
while (getline(ifs, str))
|
||||||
|
{
|
||||||
|
char *ptr = nullptr;
|
||||||
|
const long n = strtol(str.c_str(), &ptr, 10);
|
||||||
|
if (ptr && *ptr == '\0')
|
||||||
|
CropSizeList.push_back(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cancel(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
void Cancel(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user