Depends on what simple really is...
We don't use SD anymore so the example DirectX keyer I have never tried.
If you are intending to key HD video this might help.
You need two channels for HD keying to work with external switchers such as the ATEM.
Separate Key and fill signals from a multichannel Decklink card (such as a DUO) are feed as inputs
to your video production switcher, the ATEM for example.
C# code snipit.....
FileStream fs = new FileStream(FilenameTGA, FileMode.Open, FileAccess.Read);
byte[] ibuffer = new byte[fs.Length];
int bytesread = fs.Read(ibuffer, 0, ibuffer.Length);
index = 0;
// Verify image is 1280x720 and correct TGA format from header/footer not shown
for (uint y = 0; y < 720; y++)
{
for (uint x = 0; x < 1280; x++)
{
pixelindex = (((y * 1280) + x) * 4);
pixel[0] = (byte) ibuffer[pixelindex + 18]; // Blue
pixel[1] = (byte) ibuffer[pixelindex + 19]; // Green
pixel[2] = (byte) ibuffer[pixelindex + 20]; // Red
pixel[3] = (byte) ibuffer[pixelindex + 21]; // Alpha
Marshal.WriteInt32(fillbuffer, index * 4, (Int32)BitConverter.ToInt32(pixel, 0));
// use input's Alpha to generate grey scale
pixel[0] = pixel[3]; // Blue
pixel[1] = pixel[3]; // Green
pixel[2] = pixel[3]; // Red
pixel[3] = (byte) 0xff; // Solid key
Marshal.WriteInt32(keybuffer, index * 4, (Int32)BitConverter.ToInt32(pixel, 0));
index++;
}
}
fs.close();
// Loop input stream if an animated TGA sequence
Here each pixel data is read and placed in the fillbuffer. Setting each color value (RGB) to the
alpha makes a grey scale image for the keybuffer.