Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Junyan721113
Copy link
Contributor

@Junyan721113 Junyan721113 commented Oct 25, 2024

Previous context

From PR #26088:

Filter implementation, further filter-applying functions would be based on this.

Content

  • Median Blur @ CV_8U, CV_8S, CV_16U, CV_16S
  • Bilateral FIlter @ CV_8U

Performance Test Results

Geometric mean (ms)

Name of Test opencv perf imgproc MedianBlur blank opencv perf imgproc MedianBlur opencv perf imgproc MedianBlur vs opencv perf imgproc MedianBlur blank (x-factor)
Bilateral::OCL_MedianBlurFixture::(640x480, 3) 34.271 18.719 1.83
Bilateral::OCL_MedianBlurFixture::(640x480, 5) 64.742 65.875 0.98
Bilateral::OCL_MedianBlurFixture::(1280x720, 3) 102.507 56.310 1.82
Bilateral::OCL_MedianBlurFixture::(1280x720, 5) 206.591 208.401 0.99
Bilateral::OCL_MedianBlurFixture::(1920x1080, 3) 237.020 128.334 1.85
Bilateral::OCL_MedianBlurFixture::(1920x1080, 5) 504.798 508.245 0.99
Bilateral::OCL_MedianBlurFixture::(3840x2160, 3) 969.539 539.339 1.80
Bilateral::OCL_MedianBlurFixture::(3840x2160, 5) 2646.727 2654.743 1.00

Geometric mean (ms)

Name of Test opencv perf imgproc bilateral 8U blank opencv perf imgproc bilateral 8U opencv perf imgproc bilateral 8U vs opencv perf imgproc bilateral 8U blank (x-factor)
BilateralFilter::TestBilateralFilter::(640x480, 3, CV_8UC1, 1) 83.072 74.705 1.11
BilateralFilter::TestBilateralFilter::(640x480, 3, CV_8UC1, 5) 83.327 74.527 1.12
BilateralFilter::TestBilateralFilter::(640x480, 3, CV_8UC3, 1) 175.256 150.699 1.16
BilateralFilter::TestBilateralFilter::(640x480, 5, CV_8UC1, 1) 199.444 163.180 1.22
BilateralFilter::TestBilateralFilter::(640x480, 5, CV_8UC1, 5) 199.382 163.397 1.22
BilateralFilter::TestBilateralFilter::(640x480, 5, CV_8UC3, 1) 381.132 312.997 1.22
BilateralFilter::TestBilateralFilter::(640x480, 5, CV_8UC3, 5) 380.824 313.621 1.21
BilateralFilter::TestBilateralFilter::(1920x1080, 3, CV_8UC1, 1) 580.046 522.295 1.11
BilateralFilter::TestBilateralFilter::(1920x1080, 3, CV_8UC1, 5) 580.982 510.128 1.14
BilateralFilter::TestBilateralFilter::(1920x1080, 3, CV_8UC3, 1) 1351.707 1078.054 1.25
BilateralFilter::TestBilateralFilter::(1920x1080, 3, CV_8UC3, 5) 1346.484 1076.450 1.25
BilateralFilter::TestBilateralFilter::(1920x1080, 5, CV_8UC1, 1) 1368.747 1082.046 1.26
BilateralFilter::TestBilateralFilter::(1920x1080, 5, CV_8UC1, 5) 1369.512 1109.463 1.23
BilateralFilter::TestBilateralFilter::(1920x1080, 5, CV_8UC3, 1) 2912.690 2287.533 1.27
BilateralFilter::TestBilateralFilter::(1920x1080, 5, CV_8UC3, 5) 2905.603 2283.606 1.27

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@Junyan721113
Copy link
Contributor Author

Junyan721113 commented Oct 25, 2024

Issue

The original bilateralFilter function uses copyMakeBorder, which provides submatrix information, but the HAL interface does not.
As a result, although the HAL implementation passes the accuracy test, there may be a loss of precision.


int i, j, maxk, radius;

ndsrvp_assert( (cn == 1 || cn == 3) && src_data != dst_data );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to return CV_HAL_ERROR_NOT_IMPLEMENTED instead of assert. Just in case if some branches are added to main OpenCV.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@asmorkalov asmorkalov merged commit 5817b56 into opencv:4.x Nov 5, 2024
29 of 30 checks passed
@asmorkalov asmorkalov mentioned this pull request Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants