From 105272420d43aaf828287ae1e90b33d7fc7fcaff Mon Sep 17 00:00:00 2001 From: zxyyyyyyyyyyyyyyy <35585791+BBuf@users.noreply.github.com> Date: Thu, 28 May 2020 22:00:11 +0800 Subject: [PATCH 1/5] Update BilinearInterpolation.cpp --- Image Interpolation/BilinearInterpolation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Image Interpolation/BilinearInterpolation.cpp b/Image Interpolation/BilinearInterpolation.cpp index a754e7d..0069680 100644 --- a/Image Interpolation/BilinearInterpolation.cpp +++ b/Image Interpolation/BilinearInterpolation.cpp @@ -13,7 +13,7 @@ Mat BilinearInterpolation(Mat src, float sx, float sy) { if (index_i > row - 2) index_i = row - 2; int i1 = floor(index_i); int i2 = ceil(index_i); - float u = index_i - i; + float u = index_i - i1; for (int j = 0; j < dst_col; j++) { float index_j = (j + 0.5) / sy - 0.5; if (index_j < 0) index_j = 0; @@ -28,4 +28,4 @@ Mat BilinearInterpolation(Mat src, float sx, float sy) { } } return dst; -} \ No newline at end of file +} From 2d84efee3e8a1d02d8e38a5bb7adb9219366aee8 Mon Sep 17 00:00:00 2001 From: BBuf <35585791+BBuf@users.noreply.github.com> Date: Thu, 18 Feb 2021 17:45:39 +0800 Subject: [PATCH 2/5] Update BilinearInterpolation.cpp --- Image Interpolation/BilinearInterpolation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Image Interpolation/BilinearInterpolation.cpp b/Image Interpolation/BilinearInterpolation.cpp index 0069680..ce52f11 100644 --- a/Image Interpolation/BilinearInterpolation.cpp +++ b/Image Interpolation/BilinearInterpolation.cpp @@ -8,7 +8,7 @@ Mat BilinearInterpolation(Mat src, float sx, float sy) { int dst_col = round(col * sy); Mat dst(dst_row, dst_col, CV_8UC3); for (int i = 0; i < dst_row; i++) { - int index_i = (i + 0.5) / sx - 0.5; + float index_i = (i + 0.5) / sx - 0.5; if (index_i < 0) index_i = 0; if (index_i > row - 2) index_i = row - 2; int i1 = floor(index_i); From fb64f91c2d8e94788fd5432983055693104bf675 Mon Sep 17 00:00:00 2001 From: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com> Date: Tue, 29 Jun 2021 21:50:14 +0800 Subject: [PATCH 3/5] Update NearestNeighborInterpolation.cpp --- Image Interpolation/NearestNeighborInterpolation.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Image Interpolation/NearestNeighborInterpolation.cpp b/Image Interpolation/NearestNeighborInterpolation.cpp index 892561e..c62b5d2 100644 --- a/Image Interpolation/NearestNeighborInterpolation.cpp +++ b/Image Interpolation/NearestNeighborInterpolation.cpp @@ -9,8 +9,8 @@ Mat NearestNeighborInterpolation(Mat src, float sx, float sy) { Mat dst(dst_row, dst_col, CV_8UC1); for (int i = 0; i < dst_row; i++) { for (int j = 0; j < dst_col; j++) { - int pre_i = round(i / sy); - int pre_j = round(j / sx); + int pre_i = floor(i / sy); + int pre_j = floor(j / sx); if (pre_i > row - 1) pre_i = row - 1; if (pre_j > col - 1) pre_j = col - 1; dst.at(i, j) = src.at(pre_i, pre_j); @@ -22,8 +22,8 @@ Mat NearestNeighborInterpolation(Mat src, float sx, float sy) { Mat dst(dst_row, dst_col, CV_8UC3); for (int i = 0; i < dst_row; i++) { for (int j = 0; j < dst_col; j++) { - int pre_i = round(i / sy); - int pre_j = round(j / sx); + int pre_i = floor(i / sy); + int pre_j = floor(j / sx); if (pre_i > row - 1) pre_i = row - 1; if (pre_j > col - 1) pre_j = col - 1; dst.at(i, j)[0] = src.at(pre_i, pre_j)[0]; @@ -33,4 +33,4 @@ Mat NearestNeighborInterpolation(Mat src, float sx, float sy) { } return dst; } -} \ No newline at end of file +} From b9b587a74a115bfbfe99f2b58e98efdeda90c61b Mon Sep 17 00:00:00 2001 From: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com> Date: Thu, 1 Jul 2021 16:49:29 +0800 Subject: [PATCH 4/5] Update BilinearInterpolation.cpp --- Image Interpolation/BilinearInterpolation.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Image Interpolation/BilinearInterpolation.cpp b/Image Interpolation/BilinearInterpolation.cpp index ce52f11..91c9a25 100644 --- a/Image Interpolation/BilinearInterpolation.cpp +++ b/Image Interpolation/BilinearInterpolation.cpp @@ -10,14 +10,16 @@ Mat BilinearInterpolation(Mat src, float sx, float sy) { for (int i = 0; i < dst_row; i++) { float index_i = (i + 0.5) / sx - 0.5; if (index_i < 0) index_i = 0; - if (index_i > row - 2) index_i = row - 2; + if (sx < 1.0 && index_i > row - 2) index_i = row - 2; + if (sx >= 1.0 && index_i > row - 1) index_i = row - 1; int i1 = floor(index_i); int i2 = ceil(index_i); float u = index_i - i1; for (int j = 0; j < dst_col; j++) { float index_j = (j + 0.5) / sy - 0.5; if (index_j < 0) index_j = 0; - if (index_j > col - 2) index_j = col - 2; + if (sy < 1.0 && index_j > col - 2) index_j = col - 2; + if (sy >= 1.0 && index_j > col - 1) index_j = col - 1; int j1 = floor(index_j); int j2 = ceil(index_j); float v = index_j - j1; From f486884c6c8895f3386744e9508fc33d8c0464b2 Mon Sep 17 00:00:00 2001 From: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com> Date: Sat, 4 Sep 2021 16:34:18 +0800 Subject: [PATCH 5/5] Update README.md --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 0aa7953..3c598d5 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,3 @@ - MedianSideWindowFilter.cpp C++复现了CVPR2019《Side Window Filter》论文(Median Filter),实现霸气的强制保边,原理请看:https://blog.csdn.net/just_sort/article/details/93664078 - RectangleDetection.cpp C++复现了StackOverFlow上面的一个有趣的矩形检测算法,并且配合Side Window Filter可以取得更好的效果,原理请看:https://blog.csdn.net/just_sort/article/details/104754937 - - - - -![我的公众号,欢迎关注](image/weixin.jpg) -