Add Otsu's method to cv::cuda::threshold #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
Add warpAffine and resizeDown APIs in FastCV Extension #3936
- Added warpAffine function to apply affine transformations.
2x3 affine transformations for both CV_8UC1 and CV_8UC3 input
2x2 matrix-based patch extraction for grayscale images, with ROI.
- Deprecated resizeDownBy2 and resizeDownBy4 functions.
- Introduced resizeDown function to down-scale images using specified scaling factors or dimensions, supporting both single-channel (CV_8UC1) and two-channel (CV_8UC2) images.
### 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
Add FastCV DSP Initialization, QcAllocator and FastCV DSP Extension APIs #3931
Merge with https://github.com/opencv/opencv/pull/27290
**Detailed Description**
This PR introduces FastCV DSP Extension APIs within the '**cv::fastcv::dsp**' namespace.
The following APIs have been added:
1. **fcvdspinit**: Initializes the FastCV DSP environment.
2. **fcvdspdeinit**: Deinitializes the FastCV DSP environment.
3. **sumOfAbsoluteDiffs**: Computes the sum of absolute differences of an image against an 8x8 template.
4. **thresholdOtsu**: Binarizes a grayscale image using Otsu's method.
5. **FFT**: Computes the 1D or 2D Fast Fourier Transform of a real-valued matrix.
6. **IFFT**: Computes the 1D or 2D Inverse Fast Fourier Transform of a complex-valued matrix.
7. **canny**: Applies the Canny edge detector to an 8-bit grayscale image.
8. **filter2D**: Applies a generic 2D filter to an image.
The **QcAllocator** has been added to manage memory allocations on Qualcomm's Chipsets. This allocator ensures that matrices are allocated using the Qualcomm hardware memory allocator, providing efficient DSP operations.
Requires updated binary from: https://github.com/opencv/opencv_3rdparty/pull/97
Requires binary from https://github.com/opencv/opencv_3rdparty/pull/95
Lib Hash Update: https://github.com/opencv/opencv/pull/27403
### 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
Add WarpPerspective in FastCV extension #3922
### 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
Changed PatternPositionType to aruco::PatternPositionType to explicitly specify its scope.
This allows gen_java.py to correctly register disc_type, preventing constructors and
methods using this enum type from being skipped during Java wrapper generation.
Typo fix: KadewTraKuPong to KaewTraKulPong #3923
From his paper: https://scispace.com/pdf/an-improved-adaptive-background-mixture-model-for-real-time-1l517cez5l.pdf
### 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
- [x] 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
Adding FastCV extension for normalizeLocalBox u8 and f32 #3916
Fastcv extension for normalizeLocalBox u8 and f32
### 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
FastCV extension 3rd Post #3891
Adding FastCV extensions for merge, split, gemm and arithm APIs add, subtract
### 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
Added fix in order to address previously unresolved issue when building in environments with python 3.10+. Modified so that this fix does not effect 3.9 or less.
Fix bugs in checker_detector.cpp after resolving conflicts from PR #3599#3877
### This is the pull request for fixing some bugs in "Color Checker detection"
+ The link to pretrained tensorflow model for detecting Macbeth Color-checker:
https://drive.google.com/drive/folders/1JNWlmyfZKxiYQoYk6f0RzcGtHuiZq1Pz
#### 1, Detecting color-checker using Neural network
When loading the pretrained Macbeth color-checker detector model, and set it successfully to CCheckerDetector,
```
Ptr<CCheckerDetector> detector = CCheckerDetector::create();
if (!detector->setNet(net))
{
cout << "Loading Model failed: Aborting" << endl;
return 0;
}
```
then
```
if(!detector->process(image, cv::mcc::MCC24, color_checker_roi, 1, true, params)) {
std::cout<<"Color-checker not found\n";
}
Ptr<mcc::CChecker> checker = detector->getBestColorChecker();
Ptr<CCheckerDraw> cdraw = CCheckerDraw::create(checker);
cdraw->draw(image);
```
+ problem 1:
cdraw function failed to draw the correct result due to the following code block failed to update box in checker:
```
for (Ptr<CChecker> checker : checkers){
for (cv::Point2f &corner : checker->getBox())
corner += static_cast<cv::Point2f>(region.tl() + innerRegion.tl());
...
}
```
the corrected and test pass version is:
```
for (Ptr<CChecker>& checker : checkers){
std::vector<cv::Point2f> restore_box;
for (cv::Point2f& corner : checker->getBox()) {
corner += static_cast<cv::Point2f>(region.tl() + innerRegion.tl());
restore_box.emplace_back(corner);
}
checker->setBox(restore_box);
}
...
```
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
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake