Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
ImageRegion Property
See Also  Example
Leadtools.ImageProcessing.Core Namespace > BorderRemoveCommand Class : ImageRegion Property



RasterImage object that is updated with a shallow copy of image that also has a region that contains the removed borders.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property ImageRegion As RasterImage
Visual Basic (Usage)Copy Code
Dim instance As BorderRemoveCommand
Dim value As RasterImage
 
value = instance.ImageRegion
C# 
public RasterImage ImageRegion {get;}
C++/CLI 
public:
property RasterImage ImageRegion {
   RasterImage get();
}

Return Value

If BorderRemoveCommandFlags.SingleRegion| BorderRemoveCommandFlags.LeadRegion have been set in Flags, then when BorderRemoveCommand returns, this is updated with a shallow copy of image that also has a region that contains the removed borders. So set Flags to (BorderRemoveCommandFlags.SingleRegion| BorderRemoveCommandFlags.LeadRegion). It is the programmer's responsibility to dispose the region when it is no longer needed.

Example

Run the BorderRemoveCommand on an image.

Visual BasicCopy Code
Public Sub ImageRegionPropertyExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Clean.tif")

   ' Prepare the command
   Dim command As BorderRemoveCommand = New BorderRemoveCommand
   command.Border = BorderRemoveBorderFlags.All
   command.Flags = BorderRemoveCommandFlags.UseVariance Or BorderRemoveCommandFlags.SingleRegion Or BorderRemoveCommandFlags.LeadRegion
   command.Percent = 20
   command.Variance = 3
   command.WhiteNoiseLength = 9

   command.Run(leadImage)
   leadImage.AddGdiPlusRegionToRegion(Nothing, command.ImageRegion.RegionToGdiPlusRegion(Nothing), RasterRegionCombineMode.Set)

   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void ImageRegionPropertyExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Clean.tif"); 
 
   // Prepare the command 
   BorderRemoveCommand command = new BorderRemoveCommand(); 
   command.Border = BorderRemoveBorderFlags.All; 
   command.Flags = BorderRemoveCommandFlags.UseVariance | BorderRemoveCommandFlags.SingleRegion | BorderRemoveCommandFlags.LeadRegion; 
   command.Percent = 20; 
   command.Variance = 3; 
   command.WhiteNoiseLength = 9; 
 
   command.Run(image); 
   image.AddGdiPlusRegionToRegion(null, command.ImageRegion.RegionToGdiPlusRegion(null), RasterRegionCombineMode.Set);  
 
   RasterCodecs.Shutdown(); 
}

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