Sorry for the laaaate answer. Missed the notification.
I didn’t find an out-of-the-box OpenCV solution (as my perky comment suggests). Had to add some processing:
// Search color checker
Ptr<CCheckerDetector> checkerDetector = CCheckerDetector::create();
bool colorCheckerFound = checkerDetector->process(colorCheckerImage_, MCC24, 1);
if(!colorCheckerFound)
throw runtime_error("Color checker not found");
// Draw ROIs on an image and define region given contours
// I have no idea why I can't get region points directly...
cv::Mat img(colorCheckerImage_.rows, colorCheckerImage_.cols, CV_8UC3, {0, 0, 0});
Ptr<CCheckerDraw> cdraw = CCheckerDraw::create(checkerDetector->getListColorChecker()[0], CV_RGB(0, 250, 0), 1);
cdraw->draw(img);
vector<vector<Point>> contours;
vector<vector<Point>> patchesRoi;
cvtColor(img, img, COLOR_BGR2GRAY);
findContours(img, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
for(unsigned int i = 0; i < contours.size(); i++)
{
vector<Point> roi;
double epsilon = 1;
while(roi.size() != 4)
{
approxPolyDP(contours[i], roi, epsilon, true);
epsilon++;
}
// Store ROIs in vector
patchesRoi.push_back(roi);
}