From 816aa2a75865220c3a1f5837428cbf6f7df9c75f Mon Sep 17 00:00:00 2001 From: lltcggie Date: Mon, 4 Jul 2016 21:54:52 +0900 Subject: [PATCH] =?UTF-8?q?CUI=E7=89=88=E3=81=A7crop=5Fw,crop=5Fh=E3=82=AA?= =?UTF-8?q?=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe/Source.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/waifu2x-caffe/Source.cpp b/waifu2x-caffe/Source.cpp index 44f4235..26fbd77 100644 --- a/waifu2x-caffe/Source.cpp +++ b/waifu2x-caffe/Source.cpp @@ -131,6 +131,14 @@ int main(int argc, char** argv) "input image split size", false, 128, "int", cmd); + TCLAP::ValueArg cmdCropWidth("", "crop_w", + "input image split size(width)", false, + 128, "int", cmd); + + TCLAP::ValueArg cmdCropHeight("", "crop_h", + "input image split size(height)", false, + 128, "int", cmd); + TCLAP::ValueArg cmdBatchSizeFile("b", "batch_size", "input batch size", false, 1, "int", cmd); @@ -177,6 +185,15 @@ int main(int argc, char** argv) return 1; } + int crop_w = cmdCropSizeFile.getValue(); + int crop_h = cmdCropSizeFile.getValue(); + + if (cmdCropWidth.isSet()) + crop_w = cmdCropWidth.getValue(); + + if (cmdCropHeight.isSet()) + crop_h = cmdCropHeight.getValue(); + if (cmdScaleWidth.getValue() > 0) ScaleWidth = cmdScaleWidth.getValue(); else if (cmdScaleHeight.getValue() > 0) @@ -382,7 +399,7 @@ int main(int argc, char** argv) for (const auto &p : file_paths) { const Waifu2x::eWaifu2xError ret = w.waifu2x(p.first, p.second, ScaleRatio, ScaleWidth, ScaleHeight, nullptr, - cmdCropSizeFile.getValue(), cmdCropSizeFile.getValue(), + crop_w, crop_h, cmdOutputQuality.getValue() == -1 ? boost::optional() : cmdOutputQuality.getValue(), cmdOutputDepth.getValue(), use_tta, cmdBatchSizeFile.getValue()); if (ret != Waifu2x::eWaifu2xError_OK) {