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
Fixed Wredundant-move produced by GCC 13.2 (Ubuntu 24.04). #3734
### 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
- [x] 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
Mcc add perf tests improve performance #3699
Added perf tests to mcc module.
Also these optimizations have been added:
- added `parallel_for_` to `performThreshold()`
- removed `toL`/`fromL` and added `dst` to avoid copy data
- added `parallel_for_` to `elementWise()` ("batch" optimization improves performance of Windows version, Linux without changes).
Configuration:
Ryzen 5950X, 2x16 GB 3000 MHz DDR4
OS: Windows 10, Ubuntu 20.04.5 LTS
Performance results in milliseconds:
| OS and alg version | process, ms | infer, ms |
| -------------------- | ----- | ------ |
| win_default | 63.09 | 457.57 |
| win_optimized_without_batch | 48.69 | 111.78 |
| win_optimized_batch | 48.42 | 47.28 |
| linux_default | 50.88 | 300.7 |
| linux_optimized_batch| 36.06 | 41.62 |
### 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
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
Add to mcc detect and infer test #3647
merge with https://github.com/opencv/opencv_extra/pull/1153
Added a full pipeline tests:
1. detector->process(img, (TYPECHART)0, 1, true);
2. ColorCorrectionModel model(src, COLORCHECKER_Macbeth); model.run();
3. calibratedImage = model.infer(calibratedImage)*255.;
### 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
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
The argument size of get_subbox_chart_physical() is unused.
get_subbox_chart_physical() is called only in one place.
The local variable h could overflow the cast to int and lead to a
SIGILL in some environments.
deltaCIEDE2000_ fix into the MCC module
* deltaCIEDE2000_ fix, did not pass the test case 17 and 19 of Gaurav Sharma's test data
* Update ccm test case
Color Calibration Algorithm Implementation Revised
* Add utils, io helpers, the operations for linearization and distance
* Add the code for color, colorspace, linearization and ccm computation
* Add sample code for color correction
* Add the dependency to opencv_imgcodes in CMakeLists.txt
* Add the color correction tutorial, introducing build steps and
parameters
* Add sample code to color correction tutorial
* Add color correction algorithms introductions
* Update color_correction_model.markdown
* Fix warnings of whitespace, undeclared function, shadow variables.
* Fix the warnings of shadow variables, unused variable in base class.
Fix the error whitespace and 'EOF' on the docs.
* Fix the warnnings on win & macos
* Fix bugs & support Vinyl ColorChecker
* fix shadow variables warning & code style
* update document for sample
* update license
* fix linearize.hpp
* Add basic io, utils, operations helpers.
Implement color distance.
* Implement color, colorspace, linearization and ccm features.
* Add the dependencies to opencv_imgcodecs in CMakeLists.txt
* Add color correction model sample code.
Co-authored-by: Chenqi Shan <shanchenqi@huawei.com>
* Add the index markdown of color correction tutorial.
Co-authored-by: Chenqi Shan <shanchenqi@huawei.com>
* Add the introduction for color correction sample.
* Split operations into .hpp and .cpp
* Split mcc, color, colorspace and linearize into .cpp & .hpp
* Update test cases
* Split distance, io and utils into cpp & hpp.
Refer ccm.hpp in entrypoint header and update realted refs in sampe & tutorial
* add static method
* fix shared_ptr
* fix markdown for new version
* delete useless include message
* update unittests
* update docs & fix bugs for InitialwhiteBalance()
* update doc for doxygen
* update doc&DigitalSG
* replace whitespace for utils.hpp&color.hpp
* update getilluminants,imgcodes,
* Fix Mat wrapper over data from C arrays, fix doxygen's @snippet instead of direct code.
* remove array from color.h
* remove hpp from include/mcc/
* add hpp to opencv/model/mcc/
* dst unsolved
* remove bugs about dst
* add make passed
* update codes using the structure "impl"
* update documents
* update ccm member for class ColorCorrectionModel
* remove macro CV_EXPORTS_W for codes in src/*.hpp
* move class Impl private
* remove unnesasary notice
* remove trailing whitespace
* update documents&samples
* move typedef MatFunc into class and move dead codes
* minimize list of required headers, add getCCM() method
* move type: information for parameters
* move underscores _ in public headers
* add @defgroup for ccm
* move <iostream> and add getloss() method for class ColorCorrection Model
* update sample/color_correction_model.cpp
* add getIOs() function for minimize initialization of IO variables
* mcc(ccm): apply clang-format
* mcc(ccm): fix documentation, code style
* remove duplicate enum values
* add prefixes for enum values
* update codes using cv_Error
* update test_ccm file
* update test_ccm file
* update sample --help
* mcc: reduce global initializers
* update function naming style
* update formulas and note for ccm.hpp
* add const value
Co-authored-by: Chenqi Shan <shanchenqi@huawei.com>
Co-authored-by: Jinheng Zhang <zhangjinheng1@huawei.com>
Co-authored-by: Zhen Ju <juzhen@huawei.com>
Co-authored-by: Longbu Wang <wanglongbu@huawei.com.com>
Co-authored-by: shanchenqi <582533558@qq.com>
* First commit
* Updated mcc
* Fixed build warnings.
* Fixed warnings v2
* Added support for providing regions to look for the chart
* Added the neural network based detector
* Added Documentation and tests
* Fixed Warnings
* Fixed test failure
* Fixed warnings v2
* Fix Warning attemp 3
* Replaced size_t by int to fix warning
* fixed one more
* Fixed a size_t
* Fixed some bugs
* Modified the private interface a bit
* Just adding doc of what -t and -ci numbers are
* significantly improved performance of the macbeth chart detector (by two orders of magnitude, perhaps)
* Fixed the suggested changes.
* Removed imcodes from precomp
* Fixed warnings and namespace issue
* Replaced occurance of Matx33f by InputArray
Co-authored-by: Gary Bradski <garybradskigit@gmail.com>
Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>