←Select platform

IncludeRectangles Property

Summary
List of LeadRect objects which specify which portion of the page image is included as a part of the page features.

Syntax
C#
C++/CLI
Java
Python
public IList<LeadRect> IncludeRectangles { get; } 
public java.util.List<LeadRect> getIncludeRectangles(); 
public: 
property IList<LeadRect>^ IncludeRectangles { 
   IList<LeadRect>^ get(); 
} 
IncludeRectangles # get  (PageRecognitionOptions) 

Property Value

List of LeadRect objects representing the included areas of the form.

Remarks

IncludeRectangles forms the region of the image that will be considered for feature extraction, any region outside the include region will be ignored.

IncludeRectangles has no rectangle then the whole image will be considered as one include region for feature extraction.

IncludeRectangles are Ored together then the ExcludeRectangles will be excluded from the include region.

Example
C#
Java
using Leadtools.Forms.Common; 
using Leadtools.Forms.Recognition; 
using Leadtools.Codecs; 
 
///This method add a page to the form attributes. 
public void AddPageToFormAttributes(RasterImage page, FormRecognitionAttributes attributes, FormRecognitionEngine engine) 
{ 
   PageRecognitionOptions pageOptions = new PageRecognitionOptions(); 
   pageOptions.AutoCleanUp = true; 
   pageOptions.UpdateImage = true; 
   pageOptions.TradeoffMode = FormsTradeoffMode.Accurate; 
   //Page is normal page, Not a card  
   pageOptions.PageType = FormsPageType.Normal; 
   pageOptions.IncludeRectangles.Add(new LeadRect(0, 0, page.Width, page.Height)); 
   pageOptions.ExcludeRectangles.Add(new LeadRect(page.Width * 6 / 10, 
                                                          page.Height * 4 / 10, 
                                                          page.Width * 3 / 10, 
                                                          page.Height * 2 / 10)); 
   pageOptions.RegionOfInterestRectangles.Add(new LeadRect(page.Width * 1 / 10, 
                                                                   page.Height * 1 / 10, 
                                                                   page.Width * 2 / 10, 
                                                                   page.Height * 2 / 10)); 
   FormRecognitionProperties properties = engine.GetFormProperties(attributes); 
   if (properties.IsMaster) 
   { 
      engine.OpenMasterForm(attributes); 
      engine.AddMasterFormPage(attributes, page, pageOptions); 
      engine.CloseMasterForm(attributes); 
   } 
   else 
   { 
      engine.OpenForm(attributes); 
      engine.AddFormPage(attributes, page, pageOptions); 
      engine.CloseForm(attributes); 
   } 
} 
 
import static org.junit.Assert.assertTrue; 
 
import java.io.File; 
import java.io.IOException; 
import java.util.ArrayList; 
import java.util.UUID; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
 
import leadtools.*; 
import leadtools.codecs.RasterCodecs; 
import leadtools.forms.common.*; 
import leadtools.forms.recognition.*; 
 
 
public void addPageToFormAttributesExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterImage page = new RasterCodecs().load(combine(LEAD_VARS_IMAGES_DIR, "ocr1.tif")); 
 
   FormRecognitionEngine engine = new FormRecognitionEngine(); 
   FormRecognitionAttributes attributes = engine.createForm(null); 
 
   PageRecognitionOptions pageOptions = new PageRecognitionOptions(); 
   pageOptions.setAutoCleanUp(true); 
   pageOptions.setUpdateImage(true); 
   pageOptions.setTradeoffMode(FormsTradeoffMode.ACCURATE); 
 
   // Page is normal page, Not a card 
   pageOptions.setPageType(FormsPageType.NORMAL); 
   pageOptions.getIncludeRectangles().add(new LeadRect(0, 0, page.getWidth(), page.getHeight())); 
   pageOptions.getExcludeRectangles().add(new LeadRect(page.getWidth() * 6 / 10, page.getHeight() * 4 / 10, 
         page.getWidth() * 3 / 10, page.getHeight() * 2 / 10)); 
   pageOptions.getRegionOfInterestRectangles().add(new LeadRect(page.getWidth() * 1 / 10, page.getHeight() * 1 / 10, 
         page.getWidth() * 2 / 10, page.getHeight() * 2 / 10)); 
   FormRecognitionProperties properties = engine.getFormProperties(attributes); 
 
   if (properties.isMaster()) { 
      engine.openMasterForm(attributes); 
      engine.addMasterFormPage(attributes, page, pageOptions); 
      engine.closeMasterForm(attributes); 
   } else { 
      engine.addFormPage(attributes, page, pageOptions); 
      engine.closeForm(attributes); 
   } 
 
   assertTrue("Width incorrect", page.getPageCount() > 0); 
   System.out.println("Command run, page added successfully"); 
} 
Requirements

Target Platforms

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

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