views:

83

answers:

2

Quick question: At this website here http://www.vischeck.com/examples/ there are a few pictures of numbers hidden within another color to test for color blindness. Is there any way that these images can be generated algorithmically?

+1  A: 

They are based on ready-made dot fields, and you overlay a number on them, and do the coloring on the whole dot each time it is partially filled. If You know the correct colors - that will do ;)

naugtur
Can you link me to a place that generates these dot fields?
Michael
Sorry, never seen one. But You can use any pair or set of colours and generate or copy virtually any random mess of dots. The dots are not the important thing. It's only crucial that You start with an image that shows no letter when in greyscale and coloru some dots that make a letter or a number. That's all. The colours are important and You have to get them from known tests.
naugtur
A: 

What language are you coding in? It's impossible to give any definitive answer without knowing your problem well.

If you're in .NET, GDI is your best bet for generating such a dot field, but it is not simple to do algorithmically, and it's possible that these were hand-drawn.

One easier possibility you have is to use an evenly-spaced circles field, even if it's not as elegant.

Then, you'd pick two colors that aren't supposed to be (easily) distinguishable by (certain?) color-blind people.

Now, you draw a number in the square field (using one of 10 matrices for the numbers 0-9 that represent each number character with sizes compatible with the circle field) using (limited) random variations of the two colors that the person shouldn't distinguish.

In other words, if the person isn't supposed to distinguish red and green, you'd make a character using shades of red on top of a shades of green background.

You'd possibly need HUE>RGB functions, for .NET you'd have to look for a library (I remember using one from codeproject).

Camilo Martin