Hello devs can anyone know how How To decide which colour is to be removed in the background of video in javascript ?.
right now i only remove the green background
let red = frame.data[i * 4 + 0];
let green = frame.data[i * 4 + 1];
let blue = frame.data[i * 4 + 2];
const colorToRemove = green;
if ( colorToRemove > red && colorToRemove > blue && colorToRemove > 200){
frame.data[i * 4 + 3] = 0;
}
i use canvas here. the frame.data is rgba pixel value return from canvasContext.getImageData()