diff --git a/common/waifu2x.cpp b/common/waifu2x.cpp index 9fc01f1..e8d7e3d 100644 --- a/common/waifu2x.cpp +++ b/common/waifu2x.cpp @@ -1300,7 +1300,7 @@ static void Waifu2x_stbi_write_func(void *context, void *data, int size) osp->write((const char *)data, size); } -Waifu2x::eWaifu2xError Waifu2x::WriteMat(const cv::Mat &im, const boost::filesystem::path &output_file) +Waifu2x::eWaifu2xError Waifu2x::WriteMat(const cv::Mat &im, const boost::filesystem::path &output_file, const boost::optional &output_quality) { const boost::filesystem::path ip(output_file); const std::string ext = ip.extension().string(); @@ -1715,7 +1715,7 @@ Waifu2x::eWaifu2xError Waifu2x::waifu2x(const boost::filesystem::path &input_fil cv::merge(planes, write_iamge); } - ret = WriteMat(write_iamge, output_file); + ret = WriteMat(write_iamge, output_file, output_quality); if (ret != eWaifu2xError_OK) return ret; diff --git a/common/waifu2x.h b/common/waifu2x.h index aa95e19..5fc292c 100644 --- a/common/waifu2x.h +++ b/common/waifu2x.h @@ -126,7 +126,7 @@ private: , const boost::filesystem::path &modelbin_path, const boost::filesystem::path &caffemodel_path, const std::string &process); eWaifu2xError SetParameter(caffe::NetParameter ¶m, const std::string &process) const; eWaifu2xError ReconstructImage(boost::shared_ptr> net, cv::Mat &im); - eWaifu2xError WriteMat(const cv::Mat &im, const boost::filesystem::path &output_file); + static eWaifu2xError WriteMat(const cv::Mat &im, const boost::filesystem::path &output_file, const boost::optional &output_quality); eWaifu2xError BeforeReconstructFloatMatProcess(const cv::Mat &in, cv::Mat &out, bool &convertBGRflag); eWaifu2xError ReconstructFloatMat(const bool isReconstructNoise, const bool isReconstructScale, const waifu2xCancelFunc cancel_func, const cv::Mat &in, cv::Mat &out);