←Select platform

MICRCodeDetectionCommand Constructor()

Summary
Initializes a new MICRCodeDetectionCommand class object.
Syntax
C#
Objective-C
C++/CLI
Java
Python
- (instancetype)init 
public MICRCodeDetectionCommand(); 
public: 
MICRCodeDetectionCommand(); 
__init__() # Default constructor 
Remarks

The MICRCodeDetectionCommand automatically finds an MICR zone in a document image.

Example
C#
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:\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.