0

What I have: A class that recieves a BitmapImage and creates matrices for ARGB values.

What I want: To identify a specific type of picture. This picture always has a green oval in its center. But sometimes, it is a light green, sometimes a darker green, sometimes a mixture of several types of green, sometimes with shadows.

The question: What exactly can be counted as "green", regarding the ARGB-values?

Update:

Calculating the distance to pure green (0,255,0) seems like a good approach. But how to do this in a good manner?

Martin Tausch
  • 714
  • 5
  • 20
  • 1
    I would say you need to compute the distance between what you have and the "pure green" and specify a threshold. If the difference is under this threshold, you accepted as "green". – Andrei V Mar 14 '14 at 11:11
  • With 'Distance', you mean the sum of red and blue? Maybe you can write this as answer? – Martin Tausch Mar 14 '14 at 11:14
  • The distance can be as accurate as you need. I'm not up to date with color comparison so please see [this question](http://stackoverflow.com/questions/492211/is-there-an-easy-way-to-compare-how-close-two-colors-are-to-each-other) to get you started. – Andrei V Mar 14 '14 at 11:20
  • "Pure Green" isn't a Point. Pick 0,255,0 and a darkgreen spot might have a greater distance than a bluegreen one. – H H Mar 14 '14 at 11:21
  • Then: What is "pure green"? ^^ I will have a look at the link. Thx – Martin Tausch Mar 14 '14 at 11:27
  • You may use a line for the pure green from 0,1,0 to 0,255,0 and compute the closest distance to the line. You may change 1 to a larger value if needed – cellik Mar 14 '14 at 11:33
  • "Pure green", as "0, 255, 0" **is** a point in a **multidimensional** space. In a "bluegreen" you'll see that the values for _blue_ and _green_ tend to be equal, whereas in a "darkgreen" the value of _red_ is increasing to. This can be an indicator of "not green" and it might also be integrated in the distance. It depends on how accurate the distance needs to be. – Andrei V Mar 14 '14 at 11:39

1 Answers1

2

"Calculating the distance to pure green (0,255,0) seems like a good approach."

Don't go down this rabbit hole. You can't (or shouldn't at least) apply Pythagoras to the RGB colour space to get a "distance".

What you should look at is converting to a different colour space. HSL is good because it gives a single value for colour which is Hue. You can then define an acceptable range of "green" and ignore saturation.

weston
  • 54,145
  • 21
  • 145
  • 203