2
$\begingroup$

I have a set of colors in a card, as below (I can modify the card as required)

enter image description here

I have 4 reference points at four corners. I have a bunch of colors at known coordinates (in mm) from these reference points.

A user clicks a picture of this card on their phone (Android) (assume good lighting condition)

I can calibrate the distance from the number of pixels between the identified reference patterns and the known actual distance (in mm) between them

How do I extract each of these color values from the picture on the Android phone locally?

What I thought so far:

  1. Detect the reference patterns and get their coordinates.

  2. I know the actual distance in mm

  3. From the coordinates and actual distance, get pixels-per-mm

  4. I know the actual distance in mm of each of these colors

  5. Offset by that distance (pixels) for each of the colors and find the average color in a small radius around that point.

How do I achieve this?

$\endgroup$
0

1 Answer 1

0
$\begingroup$

You can do something much simpler.

With a single MATLAB line to calculate the mask:

mI = im2double(imread('https://i.sstatic.net/Nf5oe.jpg'));
mM = all((mI == 0) | (mI == 1), 3);

You will get:

enter image description here

What you need to do next:

  • Do some cleaning and identify the columns and rows.
  • Reconstruct the missing squares in columns / rows.
  • Calculate the average / median color per square.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.