Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Check for metamers in an image (using C++)

How do I check how many metamers on my image using OpenCV & C++ ?
For example in this picture, what I'm trying to do is find out that box in no 1 & 5 are metamers, also box no. 3 & 6.
So total I have 2 metamers (blue & yellow), and later I need to swap the color.

image description

What I've been doing so far is using inRange, and take an example of blue color range :
Blue no.1 (152,42,5) - BGR order
Blue no.6 (185,50,4) - BGR order

Mat mask;
cv::Scalar lowerb = cv::Scalar(150,20,0);
cv::Scalar upperb = cv::Scalar(200,50,5); 

cv::inRange(frame, lowerb, upperb, mask);

In this case I can define the target range, but later this colors will always programmatically change, so the target range will also change. And this also only for one color. How do I detect several colors that perceived the same when the target range isn't fixed ?