mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-07-02 16:42:46 +00:00
使用するモデルによっては2倍を超える拡大率でノイズが出てしまうのを修正 #7
This commit is contained in:
parent
6ac091fbe2
commit
704c83dd8d
@ -1451,6 +1451,10 @@ Waifu2x::eWaifu2xError Waifu2x::ReconstructFloatMat(const bool isReconstructNois
|
|||||||
|
|
||||||
// パディングを取り払う
|
// パディングを取り払う
|
||||||
im = im(cv::Rect(offset, offset, image_size.width, image_size.height));
|
im = im(cv::Rect(offset, offset, image_size.width, image_size.height));
|
||||||
|
|
||||||
|
// 値を0~1にクリッピング
|
||||||
|
cv::threshold(im, im, 1.0, 1.0, cv::THRESH_TRUNC);
|
||||||
|
cv::threshold(im, im, 0.0, 0.0, cv::THRESH_TOZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancel_func && cancel_func())
|
if (cancel_func && cancel_func())
|
||||||
@ -1471,6 +1475,10 @@ Waifu2x::eWaifu2xError Waifu2x::ReconstructFloatMat(const bool isReconstructNois
|
|||||||
|
|
||||||
// パディングを取り払う
|
// パディングを取り払う
|
||||||
im = im(cv::Rect(offset, offset, image_size.width, image_size.height));
|
im = im(cv::Rect(offset, offset, image_size.width, image_size.height));
|
||||||
|
|
||||||
|
// 値を0~1にクリッピング
|
||||||
|
cv::threshold(im, im, 1.0, 1.0, cv::THRESH_TRUNC);
|
||||||
|
cv::threshold(im, im, 0.0, 0.0, cv::THRESH_TOZERO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1560,6 +1568,10 @@ Waifu2x::eWaifu2xError Waifu2x::Reconstruct(const bool isReconstructNoise, const
|
|||||||
cv::cvtColor(reconstruct_image, reconstruct_image, CV_RGB2GRAY); // この地点ではまだRGBなことに注意
|
cv::cvtColor(reconstruct_image, reconstruct_image, CV_RGB2GRAY); // この地点ではまだRGBなことに注意
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 値を0~1にクリッピング
|
||||||
|
cv::threshold(reconstruct_image, reconstruct_image, 1.0, 1.0, cv::THRESH_TRUNC);
|
||||||
|
cv::threshold(reconstruct_image, reconstruct_image, 0.0, 0.0, cv::THRESH_TOZERO);
|
||||||
|
|
||||||
out = reconstruct_image;
|
out = reconstruct_image;
|
||||||
|
|
||||||
return eWaifu2xError_OK;
|
return eWaifu2xError_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user