-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Color Calibration Algorithm Implementation #2653
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
375e070 to
85fe73b
Compare
|
Great that you added an example using the macbeth detector! |
Implement color distance.
Co-authored-by: Chenqi Shan <[email protected]>
Co-authored-by: Chenqi Shan <[email protected]>
| { | ||
| public: | ||
| // detected colors, the referenceand the RGB colorspace for conversion | ||
| cv::Mat src; |
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.
do not use cv::, since this all is declared inside cv namespace
| double gamma = 2.2, int deg = 3, std::vector<double> saturated_threshold = { 0, 0.98 }, cv::Mat weights_list = Mat(), double weights_coeff = 0, | ||
| INITIAL_METHOD_TYPE initial_method_type = LEAST_SQUARE, int max_count_ = 5000, double epsilon_ = 1.e-4) : | ||
| src(src_), dst(dst_), cs(cs_), ccm_type(ccm_type_), distance(distance_), max_count(max_count_), epsilon(epsilon_) | ||
| { |
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.
please, move all implementations of the methods into .cpp files
| // std::cout << "Loss: " << loss << std::endl; | ||
| // } | ||
|
|
||
| private: |
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.
the public classes should not contain private methods and members. Either use abstract class to declare interface with separate "implementation" class (https://github.com/opencv/opencv/wiki/Coding_Style_Guide#high-level-c-interface-algorithms) or use private: class Impl; Ptr<Impl> pImpl; technique (https://en.cppreference.com/w/cpp/language/pimpl)
| return out_img; | ||
| }; | ||
|
|
||
| // void report() { |
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.
remove commented off code from public headers
| *\ param colored mask of colored color | ||
| *\ param history storage of historical conversion | ||
| */ | ||
| cv::Mat colors; |
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.
the same as above are requested: get rid of cv::, move implementation outside of .hpp files
| RGBL | ||
| }; | ||
|
|
||
| double deltaCIE76(cv::Vec3d lab1, cv::Vec3d lab2); |
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.
do we really need all this functionality in the public headers?
| { | ||
| /* *\ brief Basic class for ColorSpace. | ||
| */ | ||
| class ColorSpace |
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.
all the exported classes should use CV_EXPORTS macro; look at the other exported from OpenCV classes
|
@riskiest, thank you for the contribution! It's a lot of new functionality. Can you provide some unit tests to check that this functionality works correctly? |
|
@riskiest, also, there is build warning on Windows (see https://pullrequest.opencv.org/#/summary/contrib): Please, fix it. |
|
Thanks for reviewing the code. We are now trying to fix all the problems you mentioned. Some problems is too tricky for us. We will be very grateful if we get help from you. |
|
Oh, I just noticed that you submitted pull request from your master branch. It's not very good. Please, make a dedicated feature branch, e.g. "colorcalib", put your code there and submit pull request from this branch |
|
Changes are made in the new PR following the review, let's talk about it here: #2671. This one is closed. |
Color calibration algorithm of OE.30. https://github.com/opencv/opencv/wiki/OE-30.-Color-Calibration
An example of using ColorChecker detector to detect and then color calibration algorithm to correct: https://[email protected]/crystaldust/opencv-mcc-cc-test.git
Algorithm struct and other details: https://github.com/riskiest/color_calibration/tree/v4/doc/pdf/English/Algorithm
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.