Answer the question
In order to leave comments, you need to log in
Is there an algorithm for removing red eyes in a photo?
Good afternoon!
Tell me the algorithm for removing red eyes, if the area with the eye is selected?
That is, we have a rectangle with an eye. Then we sort through all the pixels and ...
I will implement it in JavaScript, but it would be interesting to know the formula.
That's what we have now, but not all red colors are captured.
var p = imageData.width * imageData.height, pix = p * 4, r, g, b;
while (p--) {
pix -= 4;
r = data[pix];
b = data[pix + 1];
g = data[pix + 2];
if (parseFloat(r / (g + b) / 2) > 0.4) {
data[pix] = Math.round((g + b) / 2);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question