I have an Java program that checks on an image if each pixel has his color similar to an target. Up to the point to get each pixel, nothing wrong, but the things get hard when I need to check, with an error margin, if the color of the pixel is similar to the target.
I created an formula to solve this, but is very inefficient. There is: target + (errorMargin * 10)
for maximum range and target - (errorMargin * 10)
for minimum range, and those formulas not run too well, because if I search for the color (117,132,93) in RGB, the code show me brown matches (the values is a dark green with a little blueness). So, exists some formula for determining if an color is similar to another, with error margin, that is more efficient?
Asked
Active
Viewed 684 times
0

Taarak
- 48
- 1
- 9
-
Books and articles have been written on this subject. What have you found in your searches? – Hovercraft Full Of Eels Sep 27 '17 at 01:05
-
Well, nothing. Just some maths in wikipedia and some answers in stackoverflow, and nothing of these works for me. – Taarak Sep 29 '17 at 00:48
1 Answers
0
Assuming in a universe where there is no image processing book written yet and there is no MATLAB software implemented yet, I will solve this problem by following algorithm:
- Subtract target from image.
- Take RMS value.
- Compare it with errorMargin.
A small tips for improvement:
- Try to get error margin dynamically based on image average colors.

Zaki Anwar Hamdani
- 479
- 6
- 17