←Select platform

ImageRegion Property

Summary
This property is updated with a shallow copy of the image that also has a region that contains the hole punches.
Syntax
C#
C++/CLI
Java
Python
public RasterImage ImageRegion { get; } 
public RasterImage getImageRegion(); 
public: 
property RasterImage^ ImageRegion { 
   RasterImage^ get(); 
} 
ImageRegion # get  (HolePunchRemoveCommand) 

Property Value

A shallow copy of the image that also has a region that contains the hole punches.

Remarks

If HolePunchRemoveCommandFlags.SingleRegion| HolePunchRemoveCommandFlags.LeadRegion has been set in the Flags property, then when HolePunchRemoveCommand returns, this property is updated with a shallow copy of the image that also has a region that contains the hole punches. So set Flags to HolePunchRemoveCommandFlags.SingleRegion| HolePunchRemoveCommandFlags.LeadRegion. It is the programmer's responsibility to dispose of the region when it is no longer needed.

Example

Run the HolePunchRemoveCommand on an image.

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
public void ImageRegionPropertyExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Clean.tif")); 
 
   // Prepare the command 
   HolePunchRemoveCommand command = new HolePunchRemoveCommand(); 
   command.HolePunchRemove += new EventHandler<HolePunchRemoveCommandEventArgs>(HolePunchRemoveEvent_S3); 
   command.Flags = HolePunchRemoveCommandFlags.UseDpi | HolePunchRemoveCommandFlags.UseSize | HolePunchRemoveCommandFlags.UseLocation | HolePunchRemoveCommandFlags.SingleRegion | HolePunchRemoveCommandFlags.LeadRegion; 
   command.Location = HolePunchRemoveCommandLocation.Left; 
   command.MaximumHoleHeight = image.Height; 
   command.MaximumHoleWidth = image.Width; 
   command.MinimumHoleHeight = 0; 
   command.MinimumHoleWidth = 0; 
   command.Run(image); 
 
} 
 
private void HolePunchRemoveEvent_S3(object sender, HolePunchRemoveCommandEventArgs e) 
{ 
   MessageBox.Show("Size " + "( " + e.BoundingRectangle.Left + ", " + e.BoundingRectangle.Top + ") - " + "( " + e.BoundingRectangle.Right + ", " + e.BoundingRectangle.Bottom + ")" + 
      "\n Hole Index " + e.HoleIndex.ToString() + 
      "\n Holes Total Count " + e.HoleTotalCount.ToString() + 
      "\n Black Count " + e.BlackCount.ToString() + 
      "\n White Count " + e.WhiteCount.ToString()); 
   e.Status = RemoveStatus.Remove; 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.11.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Core Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.