From a9ce01196c4f90b466212a223880a0781d20ae37 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Sun, 3 Jul 2016 22:36:06 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E4=BB=A5=E5=A4=96=E3=82=82=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=91=E3=82=A4=E3=83=AB=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/waifu2x.h | 8 ++++---- waifu2x-caffe-dll/Source.cpp | 13 ++++++++++-- waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj | 8 ++++++-- .../waifu2x-caffe-dll.vcxproj.filters | 19 ++++++++++++++++-- waifu2x-caffe-gui/waifu2x-caffe-gui.vcxproj | 4 ++-- waifu2x-caffe/Source.cpp | 20 ++++++++++++++----- waifu2x-caffe/waifu2x-caffe.vcxproj | 8 ++++++-- waifu2x-caffe/waifu2x-caffe.vcxproj.filters | 19 ++++++++++++++++-- 8 files changed, 78 insertions(+), 21 deletions(-) diff --git a/common/waifu2x.h b/common/waifu2x.h index 5e22ed3..c6e4154 100644 --- a/common/waifu2x.h +++ b/common/waifu2x.h @@ -30,10 +30,10 @@ class Waifu2x public: enum eWaifu2xModelType { - eWaifu2xModelTypeNoise, - eWaifu2xModelTypeScale, - eWaifu2xModelTypeNoiseScale, - eWaifu2xModelTypeAutoScale, + eWaifu2xModelTypeNoise = 0, + eWaifu2xModelTypeScale = 1, + eWaifu2xModelTypeNoiseScale = 2, + eWaifu2xModelTypeAutoScale = 3, }; enum eWaifu2xError diff --git a/waifu2x-caffe-dll/Source.cpp b/waifu2x-caffe-dll/Source.cpp index b2d02eb..afee9e6 100644 --- a/waifu2x-caffe-dll/Source.cpp +++ b/waifu2x-caffe-dll/Source.cpp @@ -8,9 +8,18 @@ void* Waifu2xInit(const char *mode, const int noise_level, const char *model_dir { Waifu2x *obj = new Waifu2x(); - char *argv[] = { "" }; + Waifu2x::eWaifu2xModelType mt; + if (strcmp("noise", mode) == 0) + mt = Waifu2x::eWaifu2xModelTypeNoise; + else if (strcmp("scale", mode) == 0) + mt = Waifu2x::eWaifu2xModelTypeScale; + else if (strcmp("noise_scale", mode) == 0) + mt = Waifu2x::eWaifu2xModelTypeNoiseScale; + else if (strcmp("auto_scale", mode) == 0) + mt = Waifu2x::eWaifu2xModelTypeAutoScale; - if (obj->init(1, argv, mode, noise_level, 2.0, boost::optional(), boost::optional(), model_dir, process, boost::optional(), output_depth, use_tta, crop_size, batch_size) != Waifu2x::eWaifu2xError_OK) + // if (obj->Init(1, argv, mode, noise_level, 2.0, boost::optional(), boost::optional(), model_dir, process, boost::optional(), output_depth, use_tta, crop_size, batch_size) != Waifu2x::eWaifu2xError_OK) + if (obj->Init(mt, noise_level, model_dir, process) != Waifu2x::eWaifu2xError_OK) { delete obj; return nullptr; diff --git a/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj b/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj index 8346cf7..4f41496 100644 --- a/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj +++ b/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj @@ -44,14 +44,14 @@ D:\caffe-build\install\include;D:\caffe-build\install\include\boost-1_59;$(CUDA_PATH_V7_5)\include;D:\opencv310\build_vc\install\include;$(SolutionDir)rapidjson\include;$(SolutionDir)stb;$(SolutionDir)include;$(IncludePath) D:\opencv310\build_vc\install\x64\vc12\lib;D:\caffe-build\install\lib;$(CUDA_PATH_V7_5)\lib\$(PlatformName);D:\program\boost_1_59_0\stage\x64\lib;$(LibraryPath) waifu2x-caffed - $(SolutionDir)bin + $(SolutionDir)bin\ false D:\caffe-build\install\include;D:\caffe-build\install\include\boost-1_59;$(CUDA_PATH_V7_5)\include;D:\opencv310\build_vc\install\include;$(SolutionDir)rapidjson\include;$(SolutionDir)stb;$(SolutionDir)include;$(IncludePath) D:\opencv310\build_vc\install\x64\vc12\lib;D:\caffe-build\install\lib;$(CUDA_PATH_V7_5)\lib\$(PlatformName);D:\program\boost_1_59_0\stage\x64\lib;$(LibraryPath) waifu2x-caffe - $(SolutionDir)bin + $(SolutionDir)bin\ @@ -90,10 +90,14 @@ + + + + diff --git a/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj.filters b/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj.filters index 86e4980..b4d1aa4 100644 --- a/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj.filters +++ b/waifu2x-caffe-dll/waifu2x-caffe-dll.vcxproj.filters @@ -13,18 +13,33 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {a4f9aaee-fc66-48f3-9697-9e09ffbd71e2} + ソース ファイル - ソース ファイル + common + + + common + + + common - ヘッダー ファイル + common + + + common + + + common \ No newline at end of file diff --git a/waifu2x-caffe-gui/waifu2x-caffe-gui.vcxproj b/waifu2x-caffe-gui/waifu2x-caffe-gui.vcxproj index 82712cd..2c6510e 100644 --- a/waifu2x-caffe-gui/waifu2x-caffe-gui.vcxproj +++ b/waifu2x-caffe-gui/waifu2x-caffe-gui.vcxproj @@ -43,14 +43,14 @@ true D:\caffe-build\install\include;D:\caffe-build\install\include\boost-1_59;$(CUDA_PATH_V7_5)\include;D:\opencv310\build_vc\install\include;$(SolutionDir)rapidjson\include;$(SolutionDir)stb;$(SolutionDir)include;$(IncludePath) D:\opencv310\build_vc\install\x64\vc12\lib;D:\caffe-build\install\lib;$(CUDA_PATH_V7_5)\lib\$(PlatformName);D:\program\boost_1_59_0\stage\x64\lib;$(LibraryPath) - $(SolutionDir)bin + $(SolutionDir)bin\ $(ProjectName)d false D:\caffe-build\install\include;D:\caffe-build\install\include\boost-1_59;$(CUDA_PATH_V7_5)\include;D:\opencv310\build_vc\install\include;$(SolutionDir)rapidjson\include;$(SolutionDir)stb;$(SolutionDir)include;$(IncludePath) D:\opencv310\build_vc\install\x64\vc12\lib;D:\caffe-build\install\lib;$(CUDA_PATH_V7_5)\lib\$(PlatformName);D:\program\boost_1_59_0\stage\x64\lib;$(LibraryPath) - $(SolutionDir)bin + $(SolutionDir)bin\ diff --git a/waifu2x-caffe/Source.cpp b/waifu2x-caffe/Source.cpp index 535a9e8..41a1c70 100644 --- a/waifu2x-caffe/Source.cpp +++ b/waifu2x-caffe/Source.cpp @@ -52,7 +52,7 @@ boost::filesystem::path relativePath(const boost::filesystem::path &path, const int main(int argc, char** argv) { - Waifu2x::init_liblary(); + Waifu2x::init_liblary(argc, argv); // CaffẽG[łȂOۑȂ悤ɂ google::SetLogDestination(google::INFO, ""); @@ -319,11 +319,19 @@ int main(int argc, char** argv) file_paths.emplace_back(cmdInputFile.getValue(), outputFileName); } + Waifu2x::eWaifu2xModelType mode; + if (cmdMode.getValue() == "noise") + mode = Waifu2x::eWaifu2xModelTypeNoise; + else if (cmdMode.getValue() == "scale") + mode = Waifu2x::eWaifu2xModelTypeScale; + else if (cmdMode.getValue() == "noise_scale") + mode = Waifu2x::eWaifu2xModelTypeNoiseScale; + else if (cmdMode.getValue() == "auto_scale") + mode = Waifu2x::eWaifu2xModelTypeAutoScale; + Waifu2x::eWaifu2xError ret; Waifu2x w; - ret = w.init(argc, argv, cmdMode.getValue(), cmdNRLevel.getValue(), ScaleRatio, ScaleWidth, ScaleHeight, cmdModelPath.getValue(), cmdProcess.getValue(), - cmdOutputQuality.getValue() == -1 ? boost::optional() : cmdOutputQuality.getValue(), cmdOutputDepth.getValue(), use_tta, cmdCropSizeFile.getValue(), - cmdBatchSizeFile.getValue(), cmdGPUNoFile.getValue()); + ret = w.Init(mode, cmdNRLevel.getValue(), cmdModelPath.getValue(), cmdProcess.getValue(), cmdGPUNoFile.getValue()); switch (ret) { case Waifu2x::eWaifu2xError_InvalidParameter: @@ -343,7 +351,9 @@ int main(int argc, char** argv) bool isError = false; for (const auto &p : file_paths) { - const Waifu2x::eWaifu2xError ret = w.waifu2x(p.first, p.second); + const Waifu2x::eWaifu2xError ret = w.waifu2x(p.first, p.second, ScaleRatio, ScaleWidth, ScaleHeight, nullptr, + cmdCropSizeFile.getValue(), cmdCropSizeFile.getValue(), + cmdOutputQuality.getValue() == -1 ? boost::optional() : cmdOutputQuality.getValue(), cmdOutputDepth.getValue(), use_tta, cmdBatchSizeFile.getValue()); if (ret != Waifu2x::eWaifu2xError_OK) { switch (ret) diff --git a/waifu2x-caffe/waifu2x-caffe.vcxproj b/waifu2x-caffe/waifu2x-caffe.vcxproj index 085af60..9d09422 100644 --- a/waifu2x-caffe/waifu2x-caffe.vcxproj +++ b/waifu2x-caffe/waifu2x-caffe.vcxproj @@ -43,14 +43,14 @@ true D:\caffe-build\install\include;D:\caffe-build\install\include\boost-1_59;$(CUDA_PATH_V7_5)\include;D:\opencv310\build_vc\install\include;$(SolutionDir)rapidjson\include;$(SolutionDir)stb;$(SolutionDir)include;$(IncludePath) D:\opencv310\build_vc\install\x64\vc12\lib;D:\caffe-build\install\lib;$(CUDA_PATH_V7_5)\lib\$(PlatformName);D:\program\boost_1_59_0\stage\x64\lib;$(LibraryPath) - $(SolutionDir)bin + $(SolutionDir)bin\ $(ProjectName)d false D:\caffe-build\install\include;D:\caffe-build\install\include\boost-1_59;$(CUDA_PATH_V7_5)\include;D:\opencv310\build_vc\install\include;$(SolutionDir)rapidjson\include;$(SolutionDir)stb;$(SolutionDir)include;$(IncludePath) D:\opencv310\build_vc\install\x64\vc12\lib;D:\caffe-build\install\lib;$(CUDA_PATH_V7_5)\lib\$(PlatformName);D:\program\boost_1_59_0\stage\x64\lib;$(LibraryPath) - $(SolutionDir)bin + $(SolutionDir)bin\ @@ -89,10 +89,14 @@ + + + + diff --git a/waifu2x-caffe/waifu2x-caffe.vcxproj.filters b/waifu2x-caffe/waifu2x-caffe.vcxproj.filters index 86e4980..eedf660 100644 --- a/waifu2x-caffe/waifu2x-caffe.vcxproj.filters +++ b/waifu2x-caffe/waifu2x-caffe.vcxproj.filters @@ -13,18 +13,33 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {094d18a8-12f6-44e3-bd4b-df8e363da970} + ソース ファイル - ソース ファイル + common + + + common + + + common - ヘッダー ファイル + common + + + common + + + common \ No newline at end of file