diff --git a/modules/mcc/include/opencv2/mcc/ccm.hpp b/modules/mcc/include/opencv2/mcc/ccm.hpp index 7a6fa67b6fa..a3686db473d 100644 --- a/modules/mcc/include/opencv2/mcc/ccm.hpp +++ b/modules/mcc/include/opencv2/mcc/ccm.hpp @@ -190,7 +190,7 @@ C_{sl}=f(C_s) \f] In practice, \f$n\le3\f$ is used to prevent overfitting. -There are many variants of polynomial fitting, the difference lies in the way of generating $f(x)$. +There are many variants of polynomial fitting, the difference lies in the way of generating \f$f(x)\f$. It is usually necessary to use linearized reference colors and corresponding detected colors to calculate the polynomial parameters. However, not all colors can participate in the calculation. The saturation detected colors needs to be removed. See the algorithm introduction document for details. @@ -288,7 +288,7 @@ For gamma correction formula, we take the logarithm: \f[ ln(C_{sl})={\gamma}ln(C_s),\qquad C_s\ge0\ \f] -It can be seen that there is a linear relationship between \f$ln(C_s)\f$ and \f$ln(C_{sl})\f$. It can be considered that the formula is an approximation of a polynomial relationship, that is, there exists a polynomial $f$, which makes[2]: +It can be seen that there is a linear relationship between \f$ln(C_s)\f$ and \f$ln(C_{sl})\f$. It can be considered that the formula is an approximation of a polynomial relationship, that is, there exists a polynomial \f$f\f$, which makes[2]: \f[ ln(C_{sl})=f(ln(C_s)), \qquad C_s>0\\ C_{sl}=0, \qquad C_s=0 @@ -302,8 +302,8 @@ r=polyfit(ln(R_s),ln(R_{dl}))\\ g=polyfit(ln(G_s),ln(G_{dl}))\\ b=polyfit(ln(B_s),ln(B_{dl}))\\ \f] -Note that the parameter of $ln$ cannot be 0. -Therefore, we need to delete the channels whose values are 0 from $R_s$ and $R_{dl}$, $G_s$ and $G_{dl}$, $B_s$ and $B_{dl}$. +Note that the parameter of \f$ln(*) \f$ cannot be 0. +Therefore, we need to delete the channels whose values are 0 from \f$R_s \f$ and \f$R_{dl} \f$, \f$G_s\f$ and \f$G_{dl}\f$, \f$B_s\f$ and \f$B_{dl}\f$. Therefore: @@ -363,9 +363,9 @@ class CV_EXPORTS_W ColorCorrectionModel /** @brief Color Correction Model Supported list of color cards: - - @ref COLORCHECKER_Macbeth (Macbeth ColorChecker) - - @ref COLORCHECKER_Vinyl (DKK ColorChecker) - - @ref COLORCHECKER_DigitalSG (DigitalSG ColorChecker with 140 squares) + - @ref COLORCHECKER_Macbeth, the Macbeth ColorChecker + - @ref COLORCHECKER_Vinyl, the DKK ColorChecker + - @ref COLORCHECKER_DigitalSG, the DigitalSG ColorChecker with 140 squares @param src detected colors of ColorChecker patches;\n the color type is RGB not BGR, and the color values are in [0, 1]; @@ -376,9 +376,8 @@ class CV_EXPORTS_W ColorCorrectionModel /** @brief Color Correction Model @param src detected colors of ColorChecker patches;\n the color type is RGB not BGR, and the color values are in [0, 1]; - @param colors the reference color values,the color values are in [0, 1].\n + @param colors the reference color values, the color values are in [0, 1].\n @param ref_cs the corresponding color space - NOTICE: For the list of color spaces supported, see the notes above;\n If the color type is some RGB, the format is RGB not BGR;\n */ CV_WRAP ColorCorrectionModel(const Mat& src, Mat colors, COLOR_SPACE ref_cs); @@ -386,27 +385,25 @@ class CV_EXPORTS_W ColorCorrectionModel /** @brief Color Correction Model @param src detected colors of ColorChecker patches;\n the color type is RGB not BGR, and the color values are in [0, 1]; - @param colors the reference color values,the color values are in [0, 1]. + @param colors the reference color values, the color values are in [0, 1]. @param ref_cs the corresponding color space - NOTICE: For the list of color spaces supported, see the notes above;\n If the color type is some RGB, the format is RGB not BGR; @param colored mask of colored color */ CV_WRAP ColorCorrectionModel(const Mat& src, Mat colors, COLOR_SPACE ref_cs, Mat colored); /** @brief set ColorSpace - @note It should be some RGB color space; Supported list of color cards: - - @ref COLOR_SPACE_sRGB, - - @ref COLOR_SPACE_AdobeRGB, - - @ref COLOR_SPACE_WideGamutRGB, - - @ref COLOR_SPACE_ProPhotoRGB, - - @ref COLOR_SPACE_DCI_P3_RGB, - - @ref COLOR_SPACE_AppleRGB, - - @ref COLOR_SPACE_REC_709_RGB, - - @ref COLOR_SPACE_REC_2020_RGB, - - @param cs the absolute color space that detected colors convert to;\n + - @ref COLOR_SPACE_sRGB + - @ref COLOR_SPACE_AdobeRGB + - @ref COLOR_SPACE_WideGamutRGB + - @ref COLOR_SPACE_ProPhotoRGB + - @ref COLOR_SPACE_DCI_P3_RGB + - @ref COLOR_SPACE_AppleRGB + - @ref COLOR_SPACE_REC_709_RGB + - @ref COLOR_SPACE_REC_2020_RGB + @param cs the absolute color space that detected colors convert to;\n default: @ref COLOR_SPACE_sRGB */ CV_WRAP void setColorSpace(COLOR_SPACE cs); @@ -424,8 +421,6 @@ class CV_EXPORTS_W ColorCorrectionModel CV_WRAP void setDistance(DISTANCE_TYPE distance); /** @brief set Linear - - Supported list: @param linear_type the method of linearization;\n default: @ref LINEARIZATION_GAMMA */ @@ -435,47 +430,49 @@ class CV_EXPORTS_W ColorCorrectionModel @note only valid when linear is set to "gamma";\n - @param gamma the gamma value of gamma correction; - default: 2.2;\n + @param gamma the gamma value of gamma correction;\n + default: 2.2; */ - CV_WRAP void setLinearGamma(double gamma); + CV_WRAP void setLinearGamma(const double& gamma); /** @brief set degree + @note only valid when linear is set to + - @ref LINEARIZATION_COLORPOLYFIT + - @ref LINEARIZATION_GRAYPOLYFIT + - @ref LINEARIZATION_COLORLOGPOLYFIT + - @ref LINEARIZATION_GRAYLOGPOLYFIT + @param deg the degree of linearization polynomial;\n - NOTICE: only valid when linear is set to - @ref LINEARIZATION_COLORPOLYFIT - @ref LINEARIZATION_GRAYPOLYFIT - @ref LINEARIZATION_COLORLOGPOLYFIT - @ref LINEARIZATION_GRAYLOGPOLYFIT - default: 3 + default: 3 + */ - CV_WRAP void setLinearDegree(int deg); + CV_WRAP void setLinearDegree(const int& deg); - /** @brief set SaturatedThreshold + /** @brief set SaturatedThreshold. + The colors in the closed interval [lower, upper] are reserved to participate + in the calculation of the loss function and initialization parameters @param lower the lower threshold to determine saturation;\n default: 0; - @param upper the upper threshold to determine saturation; - NOTICE: it is a tuple of [lower, upper]; - The colors in the closed interval [lower, upper] are reserved to participate - in the calculation of the loss function and initialization parameters\n + @param upper the upper threshold to determine saturation;\n default: 0 */ - CV_WRAP void setSaturatedThreshold(double lower, double upper); + CV_WRAP void setSaturatedThreshold(const double& lower, const double& upper); /** @brief set WeightsList @param weights_list the list of weight of each color;\n default: empty array */ - CV_WRAP void setWeightsList(Mat weights_list); + CV_WRAP void setWeightsList(const Mat& weights_list); /** @brief set WeightCoeff @param weights_coeff the exponent number of L* component of the reference color in CIE Lab color space;\n default: 0 */ - CV_WRAP void setWeightCoeff(double weights_coeff); + CV_WRAP void setWeightCoeff(const double& weights_coeff); /** @brief set InitialMethod @param initial_method_type the method of calculating CCM initial value;\n + default: INITIAL_METHOD_LEAST_SQUARE */ CV_WRAP void setInitialMethod(INITIAL_METHOD_TYPE initial_method_type); @@ -484,14 +481,14 @@ class CV_EXPORTS_W ColorCorrectionModel Terminal criteria to the algorithm;\n default: 5000; */ - CV_WRAP void setMaxCount(int max_count); + CV_WRAP void setMaxCount(const int& max_count); /** @brief set Epsilon @param epsilon used in MinProblemSolver-DownhillSolver;\n Terminal criteria to the algorithm;\n default: 1e-4; */ - CV_WRAP void setEpsilon(double epsilon); + CV_WRAP void setEpsilon(const double& epsilon); /** @brief make color correction */ CV_WRAP void run(); @@ -500,8 +497,8 @@ class CV_EXPORTS_W ColorCorrectionModel CV_WRAP double getLoss() const; CV_WRAP Mat get_src_rgbl() const; CV_WRAP Mat get_dst_rgbl() const; - CV_WRAP Mat get_mask() const; - CV_WRAP Mat get_weights() const; + CV_WRAP Mat getMask() const; + CV_WRAP Mat getWeights() const; /** @brief Infer using fitting ccm. @param img the input image. diff --git a/modules/mcc/samples/color_correction_model.cpp b/modules/mcc/samples/color_correction_model.cpp index c5772fae532..20df704370e 100644 --- a/modules/mcc/samples/color_correction_model.cpp +++ b/modules/mcc/samples/color_correction_model.cpp @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) Ptr cdraw = CCheckerDraw::create(checker); cdraw->draw(image); Mat chartsRGB = checker->getChartsRGB(); - Mat src = chartsRGB.col(1).clone().reshape(3, 18); + Mat src = chartsRGB.col(1).clone().reshape(3, chartsRGB.rows/3); src /= 255.0; //! [create] diff --git a/modules/mcc/src/ccm.cpp b/modules/mcc/src/ccm.cpp index 52160a2ca9d..7e26d164124 100644 --- a/modules/mcc/src/ccm.cpp +++ b/modules/mcc/src/ccm.cpp @@ -78,7 +78,7 @@ class ColorCorrectionModel::Impl @param weights_coeff type of double. @param saturate_mask the input array, type of cv::Mat. */ - void calWeightsMasks(Mat weights_list, double weights_coeff, Mat saturate_mask); + void calWeightsMasks(const Mat& weights_list, double weights_coeff, Mat saturate_mask); /** @brief Fitting nonlinear - optimization initial value by white balance. @return the output array, type of Mat @@ -99,10 +99,10 @@ class ColorCorrectionModel::Impl */ void fitting(void); - void get_color(Mat& img_, bool islinear = false); - void get_color(CONST_COLOR constcolor); - void get_color(Mat colors_, COLOR_SPACE cs_, Mat colored_); - void get_color(Mat colors_, COLOR_SPACE ref_cs_); + void getColor(Mat& img_, bool islinear = false); + void getColor(CONST_COLOR constcolor); + void getColor(Mat colors_, COLOR_SPACE cs_, Mat colored_); + void getColor(Mat colors_, COLOR_SPACE ref_cs_); /** @brief Loss function base on cv::MinProblemSolver::Function. see details in https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/optim.hpp @@ -174,7 +174,7 @@ Mat ColorCorrectionModel::Impl::prepare(const Mat& inp) } } -void ColorCorrectionModel::Impl::calWeightsMasks(Mat weights_list_, double weights_coeff_, Mat saturate_mask) +void ColorCorrectionModel::Impl::calWeightsMasks(const Mat& weights_list_, double weights_coeff_, Mat saturate_mask) { // weights if (!weights_list_.empty()) @@ -299,15 +299,15 @@ Mat ColorCorrectionModel::infer(const Mat& img, bool islinear) return p->cs.fromL(img_ccm); } -void ColorCorrectionModel::Impl::get_color(CONST_COLOR constcolor) +void ColorCorrectionModel::Impl::getColor(CONST_COLOR constcolor) { - dst = (GetColor::get_color(constcolor)); + dst = (GetColor::getColor(constcolor)); } -void ColorCorrectionModel::Impl::get_color(Mat colors_, COLOR_SPACE ref_cs_) +void ColorCorrectionModel::Impl::getColor(Mat colors_, COLOR_SPACE ref_cs_) { dst.reset(new Color(colors_, *GetCS::getInstance().get_cs(ref_cs_))); } -void ColorCorrectionModel::Impl::get_color(Mat colors_, COLOR_SPACE cs_, Mat colored_) +void ColorCorrectionModel::Impl::getColor(Mat colors_, COLOR_SPACE cs_, Mat colored_) { dst.reset(new Color(colors_, *GetCS::getInstance().get_cs(cs_), colored_)); } @@ -315,19 +315,19 @@ ColorCorrectionModel::ColorCorrectionModel(const Mat& src_, CONST_COLOR constcol : p(std::make_shared()) { p->src = src_; - p->get_color(constcolor); + p->getColor(constcolor); } ColorCorrectionModel::ColorCorrectionModel(const Mat& src_, Mat colors_, COLOR_SPACE ref_cs_) : p(std::make_shared()) { p->src = src_; - p->get_color(colors_, ref_cs_); + p->getColor(colors_, ref_cs_); } ColorCorrectionModel::ColorCorrectionModel(const Mat& src_, Mat colors_, COLOR_SPACE cs_, Mat colored_) : p(std::make_shared()) { p->src = src_; - p->get_color(colors_, cs_, colored_); + p->getColor(colors_, cs_, colored_); } void ColorCorrectionModel::setColorSpace(COLOR_SPACE cs_) @@ -346,23 +346,23 @@ void ColorCorrectionModel::setLinear(LINEAR_TYPE linear_type) { p->linear_type = linear_type; } -void ColorCorrectionModel::setLinearGamma(double gamma) +void ColorCorrectionModel::setLinearGamma(const double& gamma) { p->gamma = gamma; } -void ColorCorrectionModel::setLinearDegree(int deg) +void ColorCorrectionModel::setLinearDegree(const int& deg) { p->deg = deg; } -void ColorCorrectionModel::setSaturatedThreshold(double lower, double upper) +void ColorCorrectionModel::setSaturatedThreshold(const double& lower, const double& upper) { //std::vector saturated_threshold p->saturated_threshold = { lower, upper }; } -void ColorCorrectionModel::setWeightsList(Mat weights_list) +void ColorCorrectionModel::setWeightsList(const Mat& weights_list) { p->weights_list = weights_list; } -void ColorCorrectionModel::setWeightCoeff(double weights_coeff) +void ColorCorrectionModel::setWeightCoeff(const double& weights_coeff) { p->weights_coeff = weights_coeff; } @@ -370,11 +370,11 @@ void ColorCorrectionModel::setInitialMethod(INITIAL_METHOD_TYPE initial_method_t { p->initial_method_type = initial_method_type; } -void ColorCorrectionModel::setMaxCount(int max_count_) +void ColorCorrectionModel::setMaxCount(const int& max_count_) { p->max_count = max_count_; } -void ColorCorrectionModel::setEpsilon(double epsilon_) +void ColorCorrectionModel::setEpsilon(const double& epsilon_) { p->epsilon = epsilon_; } @@ -428,10 +428,10 @@ Mat ColorCorrectionModel::get_src_rgbl() const{ Mat ColorCorrectionModel::get_dst_rgbl() const{ return p->dst_rgbl; } -Mat ColorCorrectionModel::get_mask() const{ +Mat ColorCorrectionModel::getMask() const{ return p->mask; } -Mat ColorCorrectionModel::get_weights() const{ +Mat ColorCorrectionModel::getWeights() const{ return p->weights; } } diff --git a/modules/mcc/src/color.cpp b/modules/mcc/src/color.cpp index 921d903f8cd..ce00ac47e70 100644 --- a/modules/mcc/src/color.cpp +++ b/modules/mcc/src/color.cpp @@ -148,7 +148,7 @@ Color Color::operator[](Mat mask) return Color(maskCopyTo(colors, mask), cs); } -Mat GetColor::get_ColorChecker(const double* checker, int row) +Mat GetColor::getColorChecker(const double* checker, int row) { Mat res(row, 1, CV_64FC3); for (int i = 0; i < row; ++i) @@ -158,7 +158,7 @@ Mat GetColor::get_ColorChecker(const double* checker, int row) return res; } -Mat GetColor::get_ColorChecker_MASK(const uchar* checker, int row) +Mat GetColor::getColorCheckerMASK(const uchar* checker, int row) { Mat res(row, 1, CV_8U); for (int i = 0; i < row; ++i) @@ -168,7 +168,7 @@ Mat GetColor::get_ColorChecker_MASK(const uchar* checker, int row) return res; } -std::shared_ptr GetColor::get_color(CONST_COLOR const_color) +std::shared_ptr GetColor::getColor(CONST_COLOR const_color) { /** @brief Data is from https://www.imatest.com/wp-content/uploads/2011/11/Lab-data-Iluminate-D65-D50-spectro.xls @@ -370,23 +370,23 @@ std::shared_ptr GetColor::get_color(CONST_COLOR const_color) case cv::ccm::COLORCHECKER_Macbeth: { - Mat ColorChecker2005_LAB_D50_2_ = GetColor::get_ColorChecker(*ColorChecker2005_LAB_D50_2, 24); - Mat ColorChecker2005_COLORED_MASK_ = GetColor::get_ColorChecker_MASK(ColorChecker2005_COLORED_MASK, 24); + Mat ColorChecker2005_LAB_D50_2_ = GetColor::getColorChecker(*ColorChecker2005_LAB_D50_2, 24); + Mat ColorChecker2005_COLORED_MASK_ = GetColor::getColorCheckerMASK(ColorChecker2005_COLORED_MASK, 24); std::shared_ptr Macbeth_D50_2 = std::make_shared(ColorChecker2005_LAB_D50_2_, COLOR_SPACE_Lab_D50_2, ColorChecker2005_COLORED_MASK_); return Macbeth_D50_2; } case cv::ccm::COLORCHECKER_Vinyl: { - Mat Vinyl_LAB_D50_2__ = GetColor::get_ColorChecker(*Vinyl_LAB_D50_2, 18); - Mat Vinyl_COLORED_MASK__ = GetColor::get_ColorChecker_MASK(Vinyl_COLORED_MASK, 18); + Mat Vinyl_LAB_D50_2__ = GetColor::getColorChecker(*Vinyl_LAB_D50_2, 18); + Mat Vinyl_COLORED_MASK__ = GetColor::getColorCheckerMASK(Vinyl_COLORED_MASK, 18); std::shared_ptr Vinyl_D50_2 = std::make_shared(Vinyl_LAB_D50_2__, COLOR_SPACE_Lab_D50_2, Vinyl_COLORED_MASK__); return Vinyl_D50_2; } case cv::ccm::COLORCHECKER_DigitalSG: { - Mat DigitalSG_LAB_D50_2__ = GetColor::get_ColorChecker(*DigitalSG_LAB_D50_2, 140); + Mat DigitalSG_LAB_D50_2__ = GetColor::getColorChecker(*DigitalSG_LAB_D50_2, 140); std::shared_ptr DigitalSG_D50_2 = std::make_shared(DigitalSG_LAB_D50_2__, COLOR_SPACE_Lab_D50_2); return DigitalSG_D50_2; } diff --git a/modules/mcc/src/color.hpp b/modules/mcc/src/color.hpp index 8be475ba065..57ead3558c7 100644 --- a/modules/mcc/src/color.hpp +++ b/modules/mcc/src/color.hpp @@ -107,9 +107,9 @@ class Color class GetColor { public: - static std::shared_ptr get_color(CONST_COLOR const_color); - static Mat get_ColorChecker(const double* checker, int row); - static Mat get_ColorChecker_MASK(const uchar* checker, int row); + static std::shared_ptr getColor(CONST_COLOR const_color); + static Mat getColorChecker(const double* checker, int row); + static Mat getColorCheckerMASK(const uchar* checker, int row); }; } diff --git a/modules/mcc/src/distance.cpp b/modules/mcc/src/distance.cpp index fa535b88477..7996379e939 100644 --- a/modules/mcc/src/distance.cpp +++ b/modules/mcc/src/distance.cpp @@ -30,10 +30,10 @@ namespace cv { namespace ccm { -double deltaCIE76(cv::Vec3d lab1, cv::Vec3d lab2) { return norm(lab1 - lab2); }; +double deltaCIE76(const Vec3d& lab1, const Vec3d& lab2) { return norm(lab1 - lab2); }; -double deltaCIE94(cv::Vec3d lab1, cv::Vec3d lab2, double kH, - double kC, double kL, double k1, double k2) +double deltaCIE94(const Vec3d& lab1, const Vec3d& lab2, const double& kH, + const double& kC, const double& kL, const double& k1, const double& k2) { double dl = lab1[0] - lab2[0]; double c1 = sqrt(pow(lab1[1], 2) + pow(lab1[2], 2)); @@ -50,20 +50,20 @@ double deltaCIE94(cv::Vec3d lab1, cv::Vec3d lab2, double kH, return res > 0 ? sqrt(res) : 0; } -double deltaCIE94GraphicArts(cv::Vec3d lab1, cv::Vec3d lab2) +double deltaCIE94GraphicArts(const Vec3d& lab1, const Vec3d& lab2) { return deltaCIE94(lab1, lab2); } -double toRad(double degree) { return degree / 180 * CV_PI; }; +double toRad(const double& degree) { return degree / 180 * CV_PI; }; -double deltaCIE94Textiles(cv::Vec3d lab1, cv::Vec3d lab2) +double deltaCIE94Textiles(const Vec3d& lab1, const Vec3d& lab2) { return deltaCIE94(lab1, lab2, 1.0, 1.0, 2.0, 0.048, 0.014); } -double deltaCIEDE2000_(cv::Vec3d lab1, cv::Vec3d lab2, double kL, - double kC, double kH) +double deltaCIEDE2000_(const Vec3d& lab1, const Vec3d& lab2, const double& kL, + const double& kC, const double& kH) { double delta_L_apo = lab2[0] - lab1[0]; double l_bar_apo = (lab1[0] + lab2[0]) / 2.0; @@ -144,12 +144,12 @@ double deltaCIEDE2000_(cv::Vec3d lab1, cv::Vec3d lab2, double kL, return res > 0 ? sqrt(res) : 0; } -double deltaCIEDE2000(cv::Vec3d lab1, cv::Vec3d lab2) +double deltaCIEDE2000(const Vec3d& lab1, const Vec3d& lab2) { return deltaCIEDE2000_(lab1, lab2); } -double deltaCMC(cv::Vec3d lab1, cv::Vec3d lab2, double kL, double kC) +double deltaCMC(const Vec3d& lab1, const Vec3d& lab2, const double& kL, const double& kC) { double dL = lab2[0] - lab1[0]; double da = lab2[1] - lab1[1]; @@ -182,12 +182,12 @@ double deltaCMC(cv::Vec3d lab1, cv::Vec3d lab2, double kL, double kC) return sqrt(pow(dL / (kL * sL), 2.0) + pow(dC / (kC * sC), 2.0) + pow(dH / sH, 2.0)); } -double deltaCMC1To1(cv::Vec3d lab1, cv::Vec3d lab2) +double deltaCMC1To1(const Vec3d& lab1, const Vec3d& lab2) { return deltaCMC(lab1, lab2); } -double deltaCMC2To1(cv::Vec3d lab1, cv::Vec3d lab2) +double deltaCMC2To1(const Vec3d& lab1, const Vec3d& lab2) { return deltaCMC(lab1, lab2, 2, 1); } @@ -219,4 +219,4 @@ Mat distance(Mat src, Mat ref, DISTANCE_TYPE distance_type) }; } -} // namespace cv::ccm \ No newline at end of file +} // namespace ccm \ No newline at end of file diff --git a/modules/mcc/src/distance.hpp b/modules/mcc/src/distance.hpp index 4fc63b115ff..5acfc93cdb6 100644 --- a/modules/mcc/src/distance.hpp +++ b/modules/mcc/src/distance.hpp @@ -42,7 +42,7 @@ namespace ccm { @return distance between lab1 and lab2 */ -double deltaCIE76(Vec3d lab1, Vec3d lab2); +double deltaCIE76(const Vec3d& lab1, const Vec3d& lab2); /** @brief distance between two points in formula CIE94 @param lab1 a 3D vector @@ -55,15 +55,15 @@ double deltaCIE76(Vec3d lab1, Vec3d lab2); @return distance between lab1 and lab2 */ -double deltaCIE94(Vec3d lab1, Vec3d lab2, double kH = 1.0, - double kC = 1.0, double kL = 1.0, double k1 = 0.045, - double k2 = 0.015); +double deltaCIE94(const Vec3d& lab1, const Vec3d& lab2, const double& kH = 1.0, + const double& kC = 1.0, const double& kL = 1.0, const double& k1 = 0.045, + const double& k2 = 0.015); -double deltaCIE94GraphicArts(Vec3d lab1, Vec3d lab2); +double deltaCIE94GraphicArts(const Vec3d& lab1, const Vec3d& lab2); -double toRad(double degree); +double toRad(const double& degree); -double deltaCIE94Textiles(Vec3d lab1, Vec3d lab2); +double deltaCIE94Textiles(const Vec3d& lab1, const Vec3d& lab2); /** @brief distance between two points in formula CIE2000 @param lab1 a 3D vector @@ -73,9 +73,9 @@ double deltaCIE94Textiles(Vec3d lab1, Vec3d lab2); @param kH Hue scale @return distance between lab1 and lab2 */ -double deltaCIEDE2000_(Vec3d lab1, Vec3d lab2, double kL = 1.0, - double kC = 1.0, double kH = 1.0); -double deltaCIEDE2000(Vec3d lab1, Vec3d lab2); +double deltaCIEDE2000_(const Vec3d& lab1, const Vec3d& lab2, const double& kL = 1.0, + const double& kC = 1.0, const double& kH = 1.0); +double deltaCIEDE2000(const Vec3d& lab1, const Vec3d& lab2); /** @brief distance between two points in formula CMC @param lab1 a 3D vector @@ -85,13 +85,13 @@ double deltaCIEDE2000(Vec3d lab1, Vec3d lab2); @return distance between lab1 and lab2 */ -double deltaCMC(Vec3d lab1, Vec3d lab2, double kL = 1, double kC = 1); +double deltaCMC(const Vec3d& lab1, const Vec3d& lab2, const double& kL = 1, const double& kC = 1); -double deltaCMC1To1(Vec3d lab1, Vec3d lab2); +double deltaCMC1To1(const Vec3d& lab1, const Vec3d& lab2); -double deltaCMC2To1(Vec3d lab1, Vec3d lab2); +double deltaCMC2To1(const Vec3d& lab1, const Vec3d& lab2); -Mat distance(Mat src, Mat ref, DISTANCE_TYPE distance_type); +Mat distance(Mat src,Mat ref, DISTANCE_TYPE distance_type); } } // namespace cv::ccm diff --git a/modules/mcc/test/test_ccm.cpp b/modules/mcc/test/test_ccm.cpp index 6682f13845e..56ac51db410 100644 --- a/modules/mcc/test/test_ccm.cpp +++ b/modules/mcc/test/test_ccm.cpp @@ -95,7 +95,7 @@ TEST(CV_ccmRunColorCorrection, test_model) ASSERT_MAT_NEAR(dst_rgbl, model.get_dst_rgbl(), 1e-4); Mat mask = Mat::ones(24, 1, CV_8U); - ASSERT_MAT_NEAR(model.get_mask(), mask, 0.0); + ASSERT_MAT_NEAR(model.getMask(), mask, 0.0); Mat ccm = (Mat_(3, 3) << @@ -125,14 +125,14 @@ TEST(CV_ccmRunColorCorrection, test_masks_weights_1) Mat weights = (Mat_(8, 1) << 1.15789474, 1.26315789, 1.36842105, 1.47368421, 0.52631579, 0.63157895, 0.73684211, 0.84210526); - ASSERT_MAT_NEAR(model1.get_weights(), weights, 1e-4); + ASSERT_MAT_NEAR(model1.getWeights(), weights, 1e-4); Mat mask = (Mat_(24, 1) << true, false, false, true, false, false, true, false, false, true, false, false, true, false, false, true, false, false, true, false, false, true, false, false); - ASSERT_MAT_NEAR(model1.get_mask(), mask, 0.0); + ASSERT_MAT_NEAR(model1.getMask(), mask, 0.0); } TEST(CV_ccmRunColorCorrection, test_masks_weights_2) @@ -152,14 +152,14 @@ TEST(CV_ccmRunColorCorrection, test_masks_weights_2) 1.68623868, 1.37973155, 0.73213388, 1.0169629, 0.47430246, 1.70312161, 0.45414218, 1.15910007, 0.7540434, 1.05049802, 1.04551645, 1.54082353, 1.02453421, 0.6015915, 0.26154558); - ASSERT_MAT_NEAR(model2.get_weights(), weights, 1e-4); + ASSERT_MAT_NEAR(model2.getWeights(), weights, 1e-4); Mat mask = (Mat_(24, 1) << true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, false, true, true, false, false, true, true, true, true); - ASSERT_MAT_NEAR(model2.get_mask(), mask, 0.0); + ASSERT_MAT_NEAR(model2.getMask(), mask, 0.0); } } // namespace diff --git a/modules/mcc/tutorials/basic_ccm/color_correction_model.markdown b/modules/mcc/tutorials/basic_ccm/color_correction_model.markdown index ac510cf36ea..76b98cd3f4b 100644 --- a/modules/mcc/tutorials/basic_ccm/color_correction_model.markdown +++ b/modules/mcc/tutorials/basic_ccm/color_correction_model.markdown @@ -47,7 +47,6 @@ Here are the parameters for ColorCorrectionModel NOTICE: the color values are in [0, 1] ref_cs : the corresponding color space - NOTICE: For the list of color spaces supported, see the notes below; If the color type is some RGB, the format is RGB not BGR; Supported Color Space: Supported list of RGB color spaces: