lonekorean / diff-cam-engine

Core engine for building motion detection web apps.
Other
148 stars 19 forks source link

question about hard coded adjustments to rgb #3

Open ctrager opened 4 years ago

ctrager commented 4 years ago

Why this line? var pixelDiff = rgba[i] 0.3 + rgba[i + 1] 0.6 + rgba[i + 2] * 0.1;

Where did the 0.3, 0.6, 0.1 come from?

chrisblakley commented 1 year ago

Those values are how to calculate color luminance. You multiply them against the R, G, and B values respectively as shown in the formula for pixelDiff.

Here is some more info about that: https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color