1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #27051 from gursimarsingh:move_ccm_to_photo_module

Adding color correction module to photo module from opencv_contrib #27051

This PR moved color correction module from opencv_contrib to main repo inside photo module.

### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Gursimar Singh
2025-06-12 19:37:16 +05:30
committed by GitHub
parent dd87ffc340
commit 425d5cfcf0
34 changed files with 5387 additions and 35 deletions
+14 -25
View File
@@ -212,8 +212,10 @@ bool CCheckerDetectorImpl::
// checker color analysis
//-------------------------------------------------------------------
std::vector<Ptr<CChecker>> checkers;
Point2f total_offset = static_cast<Point2f>(region.tl());
checkerAnalysis(img_rgb_f, nc, colorCharts, checkers, asp,
img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes);
img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes,
total_offset);
#ifdef MCC_DEBUG
Mat image_checker;
@@ -223,16 +225,8 @@ bool CCheckerDetectorImpl::
#endif
for (Ptr<CChecker> checker : checkers)
{
const std::vector<Point2f>& checkerBox = checker->getBox();
std::vector<Point2f> restore_box(checkerBox.size());
for (size_t a = 0; a < checkerBox.size(); ++a) {
restore_box[a] = checkerBox[a] + static_cast<Point2f>(region.tl());
}
checker->setBox(restore_box);
{
AutoLock lock(mtx);
m_checkers.push_back(checker);
}
AutoLock lock(mtx);
m_checkers.push_back(checker);
}
}
#ifdef MCC_DEBUG
@@ -433,8 +427,10 @@ bool CCheckerDetectorImpl::
// checker color analysis
//-------------------------------------------------------------------
std::vector<Ptr<CChecker>> checkers;
Point2f total_offset = static_cast<Point2f>(region.tl() + innerRegion.tl());
checkerAnalysis(img_rgb_f, nc, colorCharts, checkers, asp,
img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes);
img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes,
total_offset);
#ifdef MCC_DEBUG
Mat image_checker;
innerCroppedImage.copyTo(image_checker);
@@ -443,16 +439,8 @@ bool CCheckerDetectorImpl::
#endif
for (Ptr<CChecker> checker : checkers)
{
const std::vector<Point2f>& checkerBox = checker->getBox();
std::vector<Point2f> restore_box(checkerBox.size());
for (size_t a = 0; a < checkerBox.size(); ++a) {
restore_box[a] = checkerBox[a] + static_cast<Point2f>(region.tl() + innerRegion.tl());
}
checker->setBox(restore_box);
{
AutoLock lock(mtx);
m_checkers.push_back(checker);
}
AutoLock lock(mtx);
m_checkers.push_back(checker);
}
}
#ifdef MCC_DEBUG
@@ -1216,7 +1204,8 @@ void CCheckerDetectorImpl::
const Mat &img_rgb_org,
const Mat &img_ycbcr_org,
std::vector<Mat> &rgb_planes,
std::vector<Mat> &ycbcr_planes)
std::vector<Mat> &ycbcr_planes,
const Point2f& offset)
{
size_t N;
std::vector<Point2f> ibox;
@@ -1252,9 +1241,9 @@ void CCheckerDetectorImpl::
if (J[i] > m_params.maxError)
continue;
// redimention box
// redimension box
for (size_t j = 0; j < 4; j++)
ibox[j] = invAsp * ibox[j];
ibox[j] = invAsp * ibox[j] + offset;
Mat charts_rgb, charts_ycbcr;
get_profile(ibox, charts_rgb, charts_ycbcr, img_rgb_org,
@@ -161,7 +161,8 @@ protected: // methods pipeline
const Mat &img_rgb_org,
const Mat &img_ycbcr_org,
std::vector<Mat> &rgb_planes,
std::vector<Mat> &ycbcr_planes);
std::vector<Mat> &ycbcr_planes,
const Point2f& offset);
virtual void
removeTooCloseDetections();