ImageEn, unit imageenproc

TImageEnProc.MatchHSVRange

TImageEnProc.MatchHSVRange


Declaration

function MatchHSVRange(HueBegin, HueEnd, SatBegin, SatEnd, ValBegin, ValEnd: Integer; ColorizeMatched: Boolean; MatchColor: TRGB; ColorizeNonMatched: Boolean; NonMatchColor: TRGB): Integer;


Description

Replace colors in an image based on hue, satuation or intensity values.
If ColorizeMatched is true then this method colorizes pixels that match the specified HSV (Hue, Saturation and Value) range to MatchColor color.
If ColorizeNonMatched is true, non-matching pixels are set to NonMatchColor.

Parameter Description
HueBegin Starting Hue value (0 to 359)
HueEnd Ending Hue value (0 to 359)
SatBegin Starting Saturation value (0 to 99)
SatEnd Ending Saturation value (0 to 99)
ValBegin Starting Intensity value (0 to 99)
ValEnd Ending Intensity value (0 to 99)
ColorizeMatched If true next parameter specifies the matched color
MatchColor New pixel color when HSV conversion fit inside specified ranges
ColorizeNonMatched If true next parameter specifies the non-matched color
NonMatchColor New pixel color when HSV conversion does not fit inside specified ranges

Returns the number of matching pixels.

Note: If the image PixelFormat is not ie24RGB, it will be converted


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Example

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Make any bluish colors in the image absolutely blue
ImageEnView1.Proc.MatchHSVRange( 170, 260, 20, 99, 0, 99, True, CreateRGB( 0, 0, 255 ), False, CreateRGB( 255, 255, 255 ));