I have an Angular project, which uses JSMPpeg library for displaying live-stream video inside canvas. Is there any way to add some listener on frame change, which could detect color on specific part of the canvas? Basically, I need to detect when specific part on the stream video becomes green. I have noticed that there's specific option in JSMpeg:
onVideoDecode(decoder, time) A callback that is called after each decoded and rendered video frame
Probably it should help with detecting frame change, but haven't succeed on implementing it and I still have no ideas about detecting color. Is it even possible?
Thanks
If it's a 2d canvas you can get a pixel with
if it's a webgl canvas you can get a pixel with
in both cases r, g, and b will be in values from 0 to 255
So you can either check for colors in some rgb range or convert to some other color space