Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.3.5
AddColorHsvRangeToRegion Method
See Also 
Leadtools Namespace > RasterImage Class : AddColorHsvRangeToRegion Method




lowerColor
Specifies the minimum (inclusive) R, G and B values. A pixel must have H,S, and V all greater than or equal to lowerColor and less than or equal to upperColor to be included in the region.
upperColor
Specifies the maximum (inclusive) R, G and B values. A pixel must have H,S, and V all greater than or equal to lowerColor and less than or equal to upperColor to be included in the region.
combineMode
The action to take regarding the existing image region, if one is defined.
Creates or updates the image region by adding a region that consists of all the pixels that fall in the given HSV color range.

Syntax

Visual Basic (Declaration) 
Public Sub AddColorHsvRangeToRegion( _
   ByVal lowerColor As RasterHsvColor, _
   ByVal upperColor As RasterHsvColor, _
   ByVal combineMode As RasterRegionCombineMode _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterImage
Dim lowerColor As RasterHsvColor
Dim upperColor As RasterHsvColor
Dim combineMode As RasterRegionCombineMode
 
instance.AddColorHsvRangeToRegion(lowerColor, upperColor, combineMode)
C# 
public void AddColorHsvRangeToRegion( 
   RasterHsvColor lowerColor,
   RasterHsvColor upperColor,
   RasterRegionCombineMode combineMode
)
Managed Extensions for C++ 
public: void AddColorHsvRangeToRegion( 
   RasterHsvColor lowerColor,
   RasterHsvColor upperColor,
   RasterRegionCombineMode combineMode
) 
C++/CLI 
public:
void AddColorHsvRangeToRegion( 
   RasterHsvColor lowerColor,
   RasterHsvColor upperColor,
   RasterRegionCombineMode combineMode
) 

Parameters

lowerColor
Specifies the minimum (inclusive) R, G and B values. A pixel must have H,S, and V all greater than or equal to lowerColor and less than or equal to upperColor to be included in the region.
upperColor
Specifies the maximum (inclusive) R, G and B values. A pixel must have H,S, and V all greater than or equal to lowerColor and less than or equal to upperColor to be included in the region.
combineMode
The action to take regarding the existing image region, if one is defined.

Example

This example will load an image, adds a region corresponding to all pure green (Hue = 85) and colors near green (+/- 10), run the InvertCommand to show the affected area before saving the image back to disk.

Remarks

This method uses the HSV color model to set a region based on a color range.

It is useful for identifying all shades of a certain color. For example, this method could be used to set a region of all green colors including:

RGB(0,1,0)
RGB(0,2,0) RGB(1,2,1)
RGB(0,1,0)
RGB(0,3,0) RGB(1,3,1) RGB(2,3,2)
RGB(0,255,0) RGB(1,255,1) RGB(2,255,2)

The diagram below shows how S and V affect the color green (H = 85):

To be added to the region a color must fall in the range lowerColor...upperColor. If you want to set a region for all red (and colors near red), you could specify lowerColor and upperColor as follows:


lowerColor (250,1,1)
upperColor (5,255,255)

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical Imaging editions.

This method does not support signed data images.

To update an existing region, you specify how the new region is to be combined with the existing one using the combineMode parameter. For more information, refer to RasterRegionCombineMode.

For more information, refer to Creating a Region.

For more information, refer to Saving A Region.

For more information, refer to Working with the Existing Region.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also