ccm.hpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. //
  5. //
  6. // License Agreement
  7. // For Open Source Computer Vision Library
  8. //
  9. // Copyright(C) 2020, Huawei Technologies Co.,Ltd. All rights reserved.
  10. // Third party copyrights are property of their respective owners.
  11. //
  12. // Licensed under the Apache License, Version 2.0 (the "License");
  13. // you may not use this file except in compliance with the License.
  14. // You may obtain a copy of the License at
  15. //
  16. // http://www.apache.org/licenses/LICENSE-2.0
  17. //
  18. // Unless required by applicable law or agreed to in writing, software
  19. // distributed under the License is distributed on an "AS IS" BASIS,
  20. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. // See the License for the specific language governing permissions and
  22. // limitations under the License.
  23. //
  24. // Author: Longbu Wang <wanglongbu@huawei.com.com>
  25. // Jinheng Zhang <zhangjinheng1@huawei.com>
  26. // Chenqi Shan <shanchenqi@huawei.com>
  27. #ifndef __OPENCV_MCC_CCM_HPP__
  28. #define __OPENCV_MCC_CCM_HPP__
  29. #include <opencv2/core.hpp>
  30. #include <opencv2/imgproc.hpp>
  31. namespace cv
  32. {
  33. namespace ccm
  34. {
  35. /** @addtogroup color_correction
  36. @{
  37. Introduction
  38. ------------
  39. The purpose of color correction is to adjust the color response of input
  40. and output devices to a known state. The device being calibrated is sometimes
  41. called the calibration source; the color space used as the standard is sometimes
  42. called the calibration target. Color calibration has been used in many industries,
  43. such as television production, games, photography, engineering, chemistry,
  44. medicine, etc. Due to the manufacturing process of the input and output equipment,
  45. the channel response has nonlinear distortion. In order to correct the picture output
  46. of the equipment, it is nessary to calibrate the captured color and the actual color.
  47. */
  48. /** @brief Enum of the possible types of ccm.
  49. */
  50. enum CCM_TYPE
  51. {
  52. CCM_3x3, ///< The CCM with the shape \f$3\times3\f$ performs linear transformation on color values.
  53. CCM_4x3, ///< The CCM with the shape \f$4\times3\f$ performs affine transformation.
  54. };
  55. /** @brief Enum of the possible types of initial method.
  56. */
  57. enum INITIAL_METHOD_TYPE
  58. {
  59. INITIAL_METHOD_WHITE_BALANCE, ///< The white balance method. The initial value is:\n
  60. /// \f$
  61. /// M_{CCM}=
  62. /// \begin{bmatrix}
  63. /// k_R & 0 & 0\\
  64. /// 0 & k_G & 0\\
  65. /// 0 & 0 & k_B\\
  66. /// \end{bmatrix}
  67. /// \f$\n
  68. /// where\n
  69. /// \f$
  70. /// k_R=mean(R_{li}')/mean(R_{li})\\
  71. /// k_R=mean(G_{li}')/mean(G_{li})\\
  72. /// k_R=mean(B_{li}')/mean(B_{li})
  73. /// \f$
  74. INITIAL_METHOD_LEAST_SQUARE, ///<the least square method is an optimal solution under the linear RGB distance function
  75. };
  76. /** @brief Macbeth and Vinyl ColorChecker with 2deg D50
  77. */
  78. enum CONST_COLOR {
  79. COLORCHECKER_Macbeth, ///< Macbeth ColorChecker
  80. COLORCHECKER_Vinyl, ///< DKK ColorChecker
  81. COLORCHECKER_DigitalSG, ///< DigitalSG ColorChecker with 140 squares
  82. };
  83. enum COLOR_SPACE {
  84. COLOR_SPACE_sRGB, ///< https://en.wikipedia.org/wiki/SRGB , RGB color space
  85. COLOR_SPACE_sRGBL, ///< https://en.wikipedia.org/wiki/SRGB , linear RGB color space
  86. COLOR_SPACE_AdobeRGB, ///< https://en.wikipedia.org/wiki/Adobe_RGB_color_space , RGB color space
  87. COLOR_SPACE_AdobeRGBL, ///< https://en.wikipedia.org/wiki/Adobe_RGB_color_space , linear RGB color space
  88. COLOR_SPACE_WideGamutRGB, ///< https://en.wikipedia.org/wiki/Wide-gamut_RGB_color_space , RGB color space
  89. COLOR_SPACE_WideGamutRGBL, ///< https://en.wikipedia.org/wiki/Wide-gamut_RGB_color_space , linear RGB color space
  90. COLOR_SPACE_ProPhotoRGB, ///< https://en.wikipedia.org/wiki/ProPhoto_RGB_color_space , RGB color space
  91. COLOR_SPACE_ProPhotoRGBL, ///< https://en.wikipedia.org/wiki/ProPhoto_RGB_color_space , linear RGB color space
  92. COLOR_SPACE_DCI_P3_RGB, ///< https://en.wikipedia.org/wiki/DCI-P3 , RGB color space
  93. COLOR_SPACE_DCI_P3_RGBL, ///< https://en.wikipedia.org/wiki/DCI-P3 , linear RGB color space
  94. COLOR_SPACE_AppleRGB, ///< https://en.wikipedia.org/wiki/RGB_color_space , RGB color space
  95. COLOR_SPACE_AppleRGBL, ///< https://en.wikipedia.org/wiki/RGB_color_space , linear RGB color space
  96. COLOR_SPACE_REC_709_RGB, ///< https://en.wikipedia.org/wiki/Rec._709 , RGB color space
  97. COLOR_SPACE_REC_709_RGBL, ///< https://en.wikipedia.org/wiki/Rec._709 , linear RGB color space
  98. COLOR_SPACE_REC_2020_RGB, ///< https://en.wikipedia.org/wiki/Rec._2020 , RGB color space
  99. COLOR_SPACE_REC_2020_RGBL, ///< https://en.wikipedia.org/wiki/Rec._2020 , linear RGB color space
  100. COLOR_SPACE_XYZ_D65_2, ///< https://en.wikipedia.org/wiki/CIE_1931_color_space , non-RGB color space
  101. COLOR_SPACE_XYZ_D65_10, ///< non-RGB color space
  102. COLOR_SPACE_XYZ_D50_2, ///< non-RGB color space
  103. COLOR_SPACE_XYZ_D50_10, ///< non-RGB color space
  104. COLOR_SPACE_XYZ_A_2, ///< non-RGB color space
  105. COLOR_SPACE_XYZ_A_10, ///< non-RGB color space
  106. COLOR_SPACE_XYZ_D55_2, ///< non-RGB color space
  107. COLOR_SPACE_XYZ_D55_10, ///< non-RGB color space
  108. COLOR_SPACE_XYZ_D75_2, ///< non-RGB color space
  109. COLOR_SPACE_XYZ_D75_10, ///< non-RGB color space
  110. COLOR_SPACE_XYZ_E_2, ///< non-RGB color space
  111. COLOR_SPACE_XYZ_E_10, ///< non-RGB color space
  112. COLOR_SPACE_Lab_D65_2, ///< https://en.wikipedia.org/wiki/CIELAB_color_space , non-RGB color space
  113. COLOR_SPACE_Lab_D65_10, ///< non-RGB color space
  114. COLOR_SPACE_Lab_D50_2, ///< non-RGB color space
  115. COLOR_SPACE_Lab_D50_10, ///< non-RGB color space
  116. COLOR_SPACE_Lab_A_2, ///< non-RGB color space
  117. COLOR_SPACE_Lab_A_10, ///< non-RGB color space
  118. COLOR_SPACE_Lab_D55_2, ///< non-RGB color space
  119. COLOR_SPACE_Lab_D55_10, ///< non-RGB color space
  120. COLOR_SPACE_Lab_D75_2, ///< non-RGB color space
  121. COLOR_SPACE_Lab_D75_10, ///< non-RGB color space
  122. COLOR_SPACE_Lab_E_2, ///< non-RGB color space
  123. COLOR_SPACE_Lab_E_10, ///< non-RGB color space
  124. };
  125. /** @brief Linearization transformation type
  126. The first step in color correction is to linearize the detected colors.
  127. Because the input color space has not been calibrated, we usually use some empirical methods to linearize.
  128. There are several common linearization methods.
  129. The first is identical transformation, the second is gamma correction, and the third is polynomial fitting.
  130. Linearization is generally an elementwise function. The mathematical symbols are as follows:
  131. \f$C\f$: any channel of a color, could be \f$R, G\f$ or \f$B\f$.
  132. \f$R, G, B\f$: \f$R, G, B\f$ channels respectively.
  133. \f$G\f$: grayscale;
  134. \f$s,sl\f$: subscript, which represents the detected data and its linearized value, the former is the input and the latter is the output;
  135. \f$d,dl\f$: subscript, which represents the reference data and its linearized value
  136. ### Identical Transformation
  137. No change is made during the Identical transformation linearization, usually because the tristimulus values of the input RGB image is already proportional to the luminance.
  138. For example, if the input measurement data is in RAW format, the measurement data is already linear, so no linearization is required.
  139. The identity transformation formula is as follows:
  140. \f[
  141. C_{sl}=C_s
  142. \f]
  143. ### Gamma Correction
  144. Gamma correction is a means of performing nonlinearity in RGB space, see the Color Space documentation for details.
  145. In the linearization part, the value of \f$\gamma\f$ is usually set to 2.2.
  146. You can also customize the value.
  147. The formula for gamma correction linearization is as follows:
  148. \f[
  149. C_{sl}=C_s^{\gamma},\qquad C_s\ge0\\
  150. C_{sl}=-(-C_s)^{\gamma},\qquad C_s<0\\\\
  151. \f]
  152. ### Polynomial Fitting
  153. Polynomial fitting uses polynomials to linearize.
  154. Provided the polynomial is:
  155. \f[
  156. f(x)=a_nx^n+a_{n-1}x^{n-1}+... +a_0
  157. \f]
  158. Then:
  159. \f[
  160. C_{sl}=f(C_s)
  161. \f]
  162. In practice, \f$n\le3\f$ is used to prevent overfitting.
  163. There are many variants of polynomial fitting, the difference lies in the way of generating \f$f(x)\f$.
  164. It is usually necessary to use linearized reference colors and corresponding detected colors to calculate the polynomial parameters.
  165. However, not all colors can participate in the calculation. The saturation detected colors needs to be removed. See the algorithm introduction document for details.
  166. #### Fitting Channels Respectively
  167. Use three polynomials, \f$r(x), g(x), b(x)\f$, to linearize each channel of the RGB color space[1-3]:
  168. \f[
  169. R_{sl}=r(R_s)\\
  170. G_{sl}=g(G_s)\\
  171. B_{sl}=b(B_s)\\
  172. \f]
  173. The polynomial is generated by minimizing the residual sum of squares between the detected data and the linearized reference data.
  174. Take the R-channel as an example:
  175. \f[
  176. R=\arg min_{f}(\Sigma(R_{dl}-f(R_S)^2)
  177. \f]
  178. It's equivalent to finding the least square regression for below equations:
  179. \f[
  180. f(R_{s1})=R_{dl1}\\
  181. f(R_{s2})=R_{dl2}\\
  182. ...
  183. \f]
  184. With a polynomial, the above equations becomes:
  185. \f[
  186. \begin{bmatrix}
  187. R_{s1}^{n} & R_{s1}^{n-1} & ... & 1\\
  188. R_{s2}^{n} & R_{s2}^{n-1} & ... & 1\\
  189. ... & ... & ... & ...
  190. \end{bmatrix}
  191. \begin{bmatrix}
  192. a_{n}\\
  193. a_{n-1}\\
  194. ... \\
  195. a_0
  196. \end{bmatrix}
  197. =
  198. \begin{bmatrix}
  199. R_{dl1}\\
  200. R_{dl2}\\
  201. ...
  202. \end{bmatrix}
  203. \f]
  204. It can be expressed as a system of linear equations:
  205. \f[
  206. AX=B
  207. \f]
  208. When the number of reference colors is not less than the degree of the polynomial, the linear system has a least-squares solution:
  209. \f[
  210. X=(A^TA)^{-1}A^TB
  211. \f]
  212. Once we get the polynomial coefficients, we can get the polynomial r.
  213. This method of finding polynomial coefficients can be implemented by numpy.polyfit in numpy, expressed here as:
  214. \f[
  215. R=polyfit(R_S, R_{dl})
  216. \f]
  217. Note that, in general, the polynomial that we want to obtain is guaranteed to monotonically increase in the interval [0,1] ,
  218. but this means that nonlinear method is needed to generate the polynomials(see [4] for detail).
  219. This would greatly increases the complexity of the program.
  220. Considering that the monotonicity does not affect the correct operation of the color correction program, polyfit is still used to implement the program.
  221. Parameters for other channels can also be derived in a similar way.
  222. #### Grayscale Polynomial Fitting
  223. In this method[2], single polynomial is used for all channels.
  224. The polynomial is still a polyfit result from the detected colors to the linear reference colors.
  225. However, only the gray of the reference colors can participate in the calculation.
  226. Since the detected colors corresponding to the gray of reference colors is not necessarily gray, it needs to be grayed.
  227. Grayscale refers to the Y channel of the XYZ color space.
  228. The color space of the detected data is not determined and cannot be converted into the XYZ space.
  229. Therefore, the sRGB formula is used to approximate[5].
  230. \f[
  231. G_{s}=0.2126R_{s}+0.7152G_{s}+0.0722B_{s}
  232. \f]
  233. Then the polynomial parameters can be obtained by using the polyfit.
  234. \f[
  235. f=polyfit(G_{s}, G_{dl})
  236. \f]
  237. After \f$f\f$ is obtained, linearization can be performed.
  238. #### Logarithmic Polynomial Fitting
  239. For gamma correction formula, we take the logarithm:
  240. \f[
  241. ln(C_{sl})={\gamma}ln(C_s),\qquad C_s\ge0\
  242. \f]
  243. 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]:
  244. \f[
  245. ln(C_{sl})=f(ln(C_s)), \qquad C_s>0\\
  246. C_{sl}=0, \qquad C_s=0
  247. \f]
  248. Because \f$exp(ln(0))\to\infty \f$, the channel whose component is 0 is directly mapped to 0 in the formula above.
  249. For fitting channels respectively, we have:
  250. \f[
  251. r=polyfit(ln(R_s),ln(R_{dl}))\\
  252. g=polyfit(ln(G_s),ln(G_{dl}))\\
  253. b=polyfit(ln(B_s),ln(B_{dl}))\\
  254. \f]
  255. Note that the parameter of \f$ln(*) \f$ cannot be 0.
  256. 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$.
  257. Therefore:
  258. \f[
  259. ln(R_{sl})=r(ln(R_s)), \qquad R_s>0\\
  260. R_{sl}=0, \qquad R_s=0\\
  261. ln(G_{sl})=g(ln(G_s)),\qquad G_s>0\\
  262. G_{sl}=0, \qquad G_s=0\\
  263. ln(B_{sl})=b(ln(B_s)),\qquad B_s>0\\
  264. B_{sl}=0, \qquad B_s=0\\
  265. \f]
  266. For grayscale polynomials, there are also:
  267. \f[
  268. f=polyfit(ln(G_{sl}),ln(G_{dl}))
  269. \f]
  270. and:
  271. \f[
  272. ln(C_{sl})=f(ln(C_s)), \qquad C_s>0\\
  273. C_sl=0, \qquad C_s=0
  274. \f]
  275. */
  276. enum LINEAR_TYPE
  277. {
  278. LINEARIZATION_IDENTITY, ///<no change is made
  279. LINEARIZATION_GAMMA, ///<gamma correction; Need assign a value to gamma simultaneously
  280. LINEARIZATION_COLORPOLYFIT, ///<polynomial fitting channels respectively; Need assign a value to deg simultaneously
  281. LINEARIZATION_COLORLOGPOLYFIT, ///<logarithmic polynomial fitting channels respectively; Need assign a value to deg simultaneously
  282. LINEARIZATION_GRAYPOLYFIT, ///<grayscale polynomial fitting; Need assign a value to deg and dst_whites simultaneously
  283. LINEARIZATION_GRAYLOGPOLYFIT ///<grayscale Logarithmic polynomial fitting; Need assign a value to deg and dst_whites simultaneously
  284. };
  285. /** @brief Enum of possible functions to calculate the distance between colors.
  286. See https://en.wikipedia.org/wiki/Color_difference for details
  287. */
  288. enum DISTANCE_TYPE
  289. {
  290. DISTANCE_CIE76, ///<The 1976 formula is the first formula that related a measured color difference to a known set of CIELAB coordinates.
  291. DISTANCE_CIE94_GRAPHIC_ARTS, ///<The 1976 definition was extended to address perceptual non-uniformities.
  292. DISTANCE_CIE94_TEXTILES,
  293. DISTANCE_CIE2000,
  294. DISTANCE_CMC_1TO1, ///<In 1984, the Colour Measurement Committee of the Society of Dyers and Colourists defined a difference measure, also based on the L*C*h color model.
  295. DISTANCE_CMC_2TO1,
  296. DISTANCE_RGB, ///<Euclidean distance of rgb color space
  297. DISTANCE_RGBL ///<Euclidean distance of rgbl color space
  298. };
  299. /** @brief Core class of ccm model
  300. Produce a ColorCorrectionModel instance for inference
  301. */
  302. class CV_EXPORTS_W ColorCorrectionModel
  303. {
  304. public:
  305. /** @brief Color Correction Model
  306. Supported list of color cards:
  307. - @ref COLORCHECKER_Macbeth, the Macbeth ColorChecker
  308. - @ref COLORCHECKER_Vinyl, the DKK ColorChecker
  309. - @ref COLORCHECKER_DigitalSG, the DigitalSG ColorChecker with 140 squares
  310. @param src detected colors of ColorChecker patches;\n
  311. the color type is RGB not BGR, and the color values are in [0, 1];
  312. @param constcolor the Built-in color card
  313. */
  314. CV_WRAP ColorCorrectionModel(const Mat& src, CONST_COLOR constcolor);
  315. /** @brief Color Correction Model
  316. @param src detected colors of ColorChecker patches;\n
  317. the color type is RGB not BGR, and the color values are in [0, 1];
  318. @param colors the reference color values, the color values are in [0, 1].\n
  319. @param ref_cs the corresponding color space
  320. If the color type is some RGB, the format is RGB not BGR;\n
  321. */
  322. CV_WRAP ColorCorrectionModel(const Mat& src, Mat colors, COLOR_SPACE ref_cs);
  323. /** @brief Color Correction Model
  324. @param src detected colors of ColorChecker patches;\n
  325. the color type is RGB not BGR, and the color values are in [0, 1];
  326. @param colors the reference color values, the color values are in [0, 1].
  327. @param ref_cs the corresponding color space
  328. If the color type is some RGB, the format is RGB not BGR;
  329. @param colored mask of colored color
  330. */
  331. CV_WRAP ColorCorrectionModel(const Mat& src, Mat colors, COLOR_SPACE ref_cs, Mat colored);
  332. /** @brief set ColorSpace
  333. @note It should be some RGB color space;
  334. Supported list of color cards:
  335. - @ref COLOR_SPACE_sRGB
  336. - @ref COLOR_SPACE_AdobeRGB
  337. - @ref COLOR_SPACE_WideGamutRGB
  338. - @ref COLOR_SPACE_ProPhotoRGB
  339. - @ref COLOR_SPACE_DCI_P3_RGB
  340. - @ref COLOR_SPACE_AppleRGB
  341. - @ref COLOR_SPACE_REC_709_RGB
  342. - @ref COLOR_SPACE_REC_2020_RGB
  343. @param cs the absolute color space that detected colors convert to;\n
  344. default: @ref COLOR_SPACE_sRGB
  345. */
  346. CV_WRAP void setColorSpace(COLOR_SPACE cs);
  347. /** @brief set ccm_type
  348. @param ccm_type the shape of color correction matrix(CCM);\n
  349. default: @ref CCM_3x3
  350. */
  351. CV_WRAP void setCCM_TYPE(CCM_TYPE ccm_type);
  352. /** @brief set Distance
  353. @param distance the type of color distance;\n
  354. default: @ref DISTANCE_CIE2000
  355. */
  356. CV_WRAP void setDistance(DISTANCE_TYPE distance);
  357. /** @brief set Linear
  358. @param linear_type the method of linearization;\n
  359. default: @ref LINEARIZATION_GAMMA
  360. */
  361. CV_WRAP void setLinear(LINEAR_TYPE linear_type);
  362. /** @brief set Gamma
  363. @note only valid when linear is set to "gamma";\n
  364. @param gamma the gamma value of gamma correction;\n
  365. default: 2.2;
  366. */
  367. CV_WRAP void setLinearGamma(const double& gamma);
  368. /** @brief set degree
  369. @note only valid when linear is set to
  370. - @ref LINEARIZATION_COLORPOLYFIT
  371. - @ref LINEARIZATION_GRAYPOLYFIT
  372. - @ref LINEARIZATION_COLORLOGPOLYFIT
  373. - @ref LINEARIZATION_GRAYLOGPOLYFIT
  374. @param deg the degree of linearization polynomial;\n
  375. default: 3
  376. */
  377. CV_WRAP void setLinearDegree(const int& deg);
  378. /** @brief set SaturatedThreshold.
  379. The colors in the closed interval [lower, upper] are reserved to participate
  380. in the calculation of the loss function and initialization parameters
  381. @param lower the lower threshold to determine saturation;\n
  382. default: 0;
  383. @param upper the upper threshold to determine saturation;\n
  384. default: 0
  385. */
  386. CV_WRAP void setSaturatedThreshold(const double& lower, const double& upper);
  387. /** @brief set WeightsList
  388. @param weights_list the list of weight of each color;\n
  389. default: empty array
  390. */
  391. CV_WRAP void setWeightsList(const Mat& weights_list);
  392. /** @brief set WeightCoeff
  393. @param weights_coeff the exponent number of L* component of the reference color in CIE Lab color space;\n
  394. default: 0
  395. */
  396. CV_WRAP void setWeightCoeff(const double& weights_coeff);
  397. /** @brief set InitialMethod
  398. @param initial_method_type the method of calculating CCM initial value;\n
  399. default: INITIAL_METHOD_LEAST_SQUARE
  400. */
  401. CV_WRAP void setInitialMethod(INITIAL_METHOD_TYPE initial_method_type);
  402. /** @brief set MaxCount
  403. @param max_count used in MinProblemSolver-DownhillSolver;\n
  404. Terminal criteria to the algorithm;\n
  405. default: 5000;
  406. */
  407. CV_WRAP void setMaxCount(const int& max_count);
  408. /** @brief set Epsilon
  409. @param epsilon used in MinProblemSolver-DownhillSolver;\n
  410. Terminal criteria to the algorithm;\n
  411. default: 1e-4;
  412. */
  413. CV_WRAP void setEpsilon(const double& epsilon);
  414. /** @brief make color correction */
  415. CV_WRAP void run();
  416. CV_WRAP Mat getCCM() const;
  417. CV_WRAP double getLoss() const;
  418. CV_WRAP Mat get_src_rgbl() const;
  419. CV_WRAP Mat get_dst_rgbl() const;
  420. CV_WRAP Mat getMask() const;
  421. CV_WRAP Mat getWeights() const;
  422. /** @brief Infer using fitting ccm.
  423. @param img the input image.
  424. @param islinear default false.
  425. @return the output array.
  426. */
  427. CV_WRAP Mat infer(const Mat& img, bool islinear = false);
  428. class Impl;
  429. private:
  430. std::shared_ptr<Impl> p;
  431. };
  432. //! @} ccm
  433. } // namespace ccm
  434. } // namespace cv
  435. #endif