Show the brightness channel for each pixel
I want to shomewho calculate for each pixel which channel is the brightness, so for example, if we have for a specific point, rgba(100, 50, 200, 255), I would like rgba(0, 0, 255, 255) in return
I'm targeting JavaScript. With Python I would probably use numpy, but not sure how to do it in JS as I don't have that library.
Does CV has any in built library? How can I achieve that result whithout looping all the data buffer? In case of having to loop, which is the fastest way?
Thanks a lot in advance!
EDIT: Original vs Result