-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add Otsu's method to cv::cuda::threshold #3943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc @cudawarped |
@troelsy Your test currently doesn't use the Otsu method and when it does it fails the assert. I can't review the PR until this is fixed. How does the performance of this compare to the CPU version? |
You're measuring the API calls there not the execution time of the kernels/memory allocs etc.. As you are including synchronization this should be about the same but in general it is not the same thing. If there wasn't any synchronization the time for the API calls would be much much smaller than the execution time.
You should be able to reduce the allocations/deallocations by using |
@cudawarped What's the next step? The test fails, but it says Should I do something about the histogram implementation or should we let it be for now? |
Please ignore the error. Looks like some bug in our CI scripts. I'll take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Add Otsu's method to cv::cuda::threshold opencv#3943 I implemented Otsu's method in CUDA for a separate project and want to add it to cv::cuda::threshold I have made an effort to use existing OpenCV functions in my code, but I had some trouble with `ThresholdTypes` and `cv::cuda::calcHist`. I couldn't figure out how to include `precomp.hpp` to get the definition of `ThresholdTypes`. For `cv::cuda::calcHist` I tried adding `opencv_cudaimgproc`, but it creates a circular dependency on `cudaarithm`. I have include a simple implementation of `calcHist` so the code runs, but I would like input on how to use `cv::cuda::calcHist` instead. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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
I implemented Otsu's method in CUDA for a separate project and want to add it to cv::cuda::threshold
I have made an effort to use existing OpenCV functions in my code, but I had some trouble with
ThresholdTypes
andcv::cuda::calcHist
. I couldn't figure out how to includeprecomp.hpp
to get the definition ofThresholdTypes
. Forcv::cuda::calcHist
I tried addingopencv_cudaimgproc
, but it creates a circular dependency oncudaarithm
. I have include a simple implementation ofcalcHist
so the code runs, but I would like input on how to usecv::cuda::calcHist
instead.Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.