ImageEn, unit imageenview

TImageEnView.SelectChromaKey

TImageEnView.SelectChromaKey


Declaration


procedure SelectChromaKey(Op: TIESelOp = iespReplace); overload;
procedure SelectChromaKey(KeyPixelX, KeyPixelY: integer; Op: TIESelOp = iespReplace); overload;


Description


Uses a ChromaKey algorithm to select all pixels of a particular hue. SelectChromaKey uses the options in ChromaKeyOptions.

If the first overload is used KeyColor specifies the color of the background. With the second overload, the specified pixel is used as the key color.
Use Op = iespReplace to replace the existing selection, or iespAdd to append to the existing selection

A ChromaKey image contains a solid color block that is removed so that it can be applied to a background. E.g. in the following image the key color is neon green (R=0/G=254/B=0).



For more information on ChromaKey: en.wikipedia.org/wiki/Chroma_key

Notes:
- This is the programmatic equivalent of setting miSelectChromaKey in MouseInteract
- A bitmap/non-vector selection is used. You can use IsPointInsideSelection to determine whether specific pixels are selected.


Examples


// Load a chroma key file, guess the chroma key color and select it
ImageEnView1.IO.LoadFromFile( 'D:\Chroma.png' );
ImageEnView1.ChromaKeyOptions.KeyColor := clNone;
ImageEnView1.SelectChromaKey();

// Select subject in image with green chroma-key background
ImageEnView1.ChromaKeyOptions.KeyColor := clGreen;
ImageEnView1.ChromaKeyOptions.Mode := iecSubject;
ImageEnView1.ChromaKeyOptions.Saturation := 35;
ImageEnView1.ChromaKeyOptions.Tolerance := 0.25;
ImageEnView1.SelectChromaKey();


See Also


- ChromaKeyOptions
- GuessChromaKeyColor
- RemoveChromaKey
- SelectionIntensity
- SelectionBase
- SelectMagicWand
- SelectColors