←Select platform

SearchingZone Property

Summary
Sets and gets a LeadRect structure that represents the area to be searched.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public LeadRect SearchingZone { get; set; } 
@property (nonatomic, assign) LeadRect searchingZone; 
public void setSearchingZone( 
   LeadRect leadRect 
); 
public: 
property LeadRect SearchingZone { 
   LeadRect get(); 
   void set (    LeadRect ); 
} 
SearchingZone # get and set (MICRCodeDetectionCommand) 

Property Value

A LeadRect structure that represents the area to be searched.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
 
public void MICRCodeDetectionCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "MICR_SAMPLE.tif")); 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "MICRCode.bmp"); 
 
   // Prepare the command 
   MICRCodeDetectionCommand command = new MICRCodeDetectionCommand(); 
 
   command.SearchingZone = new LeadRect(0, 0, image.Width, image.Height); 
 
   command.Run(image); 
 
   CopyRectangleCommand copyCommand = new CopyRectangleCommand(); 
   copyCommand.Rectangle = new LeadRect(command.MICRZone.Left, 
                                        command.MICRZone.Top, 
                                        command.MICRZone.Width, 
                                        command.MICRZone.Height); 
   copyCommand.Run(image); 
 
   RasterImage destImage = copyCommand.DestinationImage; 
   if (destImage != null) 
   { 
      // Save it to disk 
      codecs.Save(destImage, destFileName, RasterImageFormat.Bmp, 24); 
   } 
 
   //Save OCRA zones 
   for (int i = 0; i < command.OCRAZones.Length; i++) 
   { 
      copyCommand.Rectangle = new LeadRect(command.OCRAZones[i].Left, 
                                           command.OCRAZones[i].Top, 
                                           command.OCRAZones[i].Width, 
                                           command.OCRAZones[i].Height); 
 
      copyCommand.Run(image); 
 
      destImage = copyCommand.DestinationImage; 
      if (destImage != null) 
      { 
         // Save OCRA to disk 
         destFileName = Path.Combine(LEAD_VARS.ImagesDir, i + "_OCRA.bmp"); 
         codecs.Save(destImage, destFileName, RasterImageFormat.Bmp, 24); 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.Test; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.assertTrue; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.CopyRectangleCommand; 
import leadtools.imageprocessing.core.MICRCodeDetectionCommand; 
 
 
public void micrCodeDetectionCommandExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.setThrowExceptionsOnInvalidImages(true); 
 
   RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "MICR_SAMPLE.tif")); 
   String destFileName = combine(LEAD_VARS_IMAGES_DIR, "MICRCode.bmp"); 
 
   // Prepare the command 
   MICRCodeDetectionCommand command = new MICRCodeDetectionCommand(); 
 
   command.setSearchingZone(new LeadRect(0, 0, image.getWidth(), image.getHeight())); 
 
   command.run(image); 
 
   CopyRectangleCommand copyCommand = new CopyRectangleCommand(); 
   copyCommand.setRectangle(new LeadRect(command.getMICRZone().getLeft(), command.getMICRZone().getTop(), 
         command.getMICRZone().getWidth(), command.getMICRZone().getHeight())); 
   copyCommand.run(image); 
 
   RasterImage destImage = copyCommand.getDestinationImage(); 
   if (destImage != null) { 
      // Save it to disk 
      codecs.save(destImage, destFileName, RasterImageFormat.BMP, 24); 
   } 
 
   assertTrue(new File(destFileName).exists()); 
   System.out.println("Command run, image saved to " + destFileName); 
 
   // Save OCRA zones 
   for (int i = 0; i < command.getOCRAZones().length; i++) { 
      copyCommand.setRectangle(new LeadRect(command.getOCRAZones()[i].getLeft(), command.getOCRAZones()[i].getTop(), 
            command.getOCRAZones()[i].getWidth(), command.getOCRAZones()[i].getHeight())); 
 
      copyCommand.run(image); 
 
      destImage = copyCommand.getDestinationImage(); 
      if (destImage != null) { 
         // Save OCRA to disk 
         destFileName = combine(LEAD_VARS_IMAGES_DIR, "_OCRA.bmp"); 
         codecs.save(destImage, destFileName, RasterImageFormat.BMP, 24); 
      } 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 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.