Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharp pre-convert to Grayscale #43

Open
Wade-BuildOtto opened this issue Jun 21, 2021 · 1 comment
Open

Sharp pre-convert to Grayscale #43

Wade-BuildOtto opened this issue Jun 21, 2021 · 1 comment

Comments

@Wade-BuildOtto
Copy link

Why not use sharp to pre-convert to grayscale, then you only have a single 0-255 range to deal with?

@ajbogh
Copy link
Owner

ajbogh commented Jun 22, 2021

Good question. If we converted to grayscale first then that would be an extra operation on the image for each frame rendered. We do have a feature for monochrome motion detection which ignores the RGB colors and just uses one channel. Using the RGB colors doesn't add too much complexity to the code and it does allow us to handle each individual wavelength's contribution.

https://github.com/ajbogh/nMotion/blob/master/src/lib/util.mjs#L35

If you happen to play with the code and find a better way to write the above function, then I'd be happy to include it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants