1
$\begingroup$

I have some two tone origami paper. This particular paper comes in six types, each with a different pair of colors. Here's an image that shows all six:

Two tone paper

Given a picture of one of these sheets, I want to figure out which type it is, and do so in a way that's resilient to common changes in lighting.

Extracting the actual color pair isn't too hard. I find the saddle point at the center of the sheet, do four flood fills (with some sanity checks for square-ness) to estimate the layout and correct the perspective, then average the RGB values of the top-right and bottom-left separately from the top-left and bottom-right (with some margin to avoid the borders).

My current method to classify the sampled color pair is to just pre-measure each known sheet, hard-code the rgb pairs they measure as, then assume new samples are whatever color pair they're closest to. The distance metric I'm using is just simple euclidean distance in the 6d r1,g1,b1,r2,g2,b2 space, except I also compute the distance after swapping the first and second color and take the minimum (to account for the fact that they may be out of order).

The problem with this approach is that it's very sensitive to lighting. For example, I can consistently distinguish between RedBlue and RedBlack but if I make the room brighter or dimmer then one will tend to dominate the other.

One thing I've considered doing is to divide the rgb values by the average of the whole pair. This would tend to cancel luminosity out, I think. But lighting also varies in color, and I'd prefer this to work whether or not the lights are incandescent or LED. One way I might be able to deal with that is to take the ratio of each color channel within a pair, and then treat that as a point in 3d euclidean space to compare. Or maybe the difference? It's hard to say without a variety of rooms to test in.

Ideas? Insight? Experience?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.