MICR reading problem with Barcode SDK and using MICRE13B barcode type

Having problems reading MICR on a check (see Sample-check-3.png) with barcode SDK. Specified “MICRE13B” barcode type. Was able to read MICR on another check (see Sample-check-2.png). Do you know why the first check isn’t working? Tried the “QualitySettings.HighQuality” and no luck.

Sample-check-3.jpg (200.9 KB)
Sample-check-2.jpg (587.8 KB)

@dougancora,

Thanks for the barcode image files.

Which version of Aspose.BarCode for .NET/Java you are using? Could you please share your sample code snippet that you are using to read MICR barcodes. We will check your issue soon.

Here is the barcode SDK used:
image.png (15.7 KB)

Here is the source code for the test app:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.BarCode.BarCodeRecognition;


namespace AsposeConsole
{
    internal class Program
    {
        static void Main(string[] args)
        {
      string licenseFileName = @"X:\Vendors\Aspose\Stuff\Aspose.BarCode.NET.lic";
      SetAsposeBarCodeLicense(licenseFileName);

      if (args.Length == 0)
            {
        var btypes = DecodeType.AllSupportedTypes.GetSingleTypes();
        Console.WriteLine("Barcode types: ");
        foreach (var btype in btypes)
                {
          Console.WriteLine(btype.TypeName);
                }
        return;
      }

      string filename = args[0];
      string barcodes = "none";
      if (args.Length > 1)
        barcodes = args[1];
      int quality = 2;
      if (args.Length > 2)
        quality = Int32.Parse(args[2]);

      recognizebarcodes(filename, barcodes, quality);
    }

    /// <summary>
    /// Recognize barcodes.
    /// </summary>
    /// <param name="filename">Full path/filename for barcode image file (PNG/JPEG).</param>
    /// <param name="encodetype">List of desired barcodes (semicolon separated).</param>
    /// <param name="quality">Capture quality (1=Fast, 2=Normal, 3=Excellent)</param>
    private static void recognizebarcodes(string filename, string encodetype, int quality)
    {
      // Initialize the BarCodeReader 
      Console.WriteLine("** Start - reviewing: " + filename);
      DateTime starttime = DateTime.Now;
      Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = encodetype.ToLower().Equals("none") ? new Aspose.BarCode.BarCodeRecognition.BarCodeReader(filename) :
                  new Aspose.BarCode.BarCodeRecognition.BarCodeReader(filename, getBarCodeType(encodetype));

      switch (quality)
      {
        case 1:
          reader.QualitySettings = QualitySettings.HighPerformance;
          break;
        case 2:
          reader.QualitySettings = QualitySettings.NormalQuality;
          break;
        case 3:
          reader.QualitySettings = QualitySettings.HighQuality;
          break;
      }

      var res = reader.ReadBarCodes();
      string barCodeText = "";
      foreach (var barcode in res)
      {
        barCodeText += barcode.CodeTypeName + ": " + barcode.CodeText + Environment.NewLine;
      }
      DateTime endtime = DateTime.Now;
      var diffTime = (endtime - starttime).TotalMilliseconds;

      Console.WriteLine("** End - time(ms): " + diffTime.ToString());

      if (barCodeText.Length == 0)
        barCodeText = "<No barcodes>";

      Console.WriteLine("barcodes: " + barCodeText);
    }

    private static BaseDecodeType[] getBarCodeType(string barcodetype)
    {
      string bcs = barcodetype.ToLower().Trim();
      var types = DecodeType.AllSupportedTypes.GetSingleTypes().Where(w => bcs.Contains(w.TypeName.ToLower().Trim())).Select(s => s).ToArray();
      if (types == null || types.Length <= 0)
        return new BaseDecodeType[] { DecodeType.None };
      else
        return types;
    }

    public static void SetAsposeBarCodeLicense(string licenseFileName)
    {
      try
      {

        Aspose.BarCode.License lic = new Aspose.BarCode.License();
        lic.SetLicense(licenseFileName);
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message);
      }
    }

  }


}

@dougancora,

Thanks for the sample and version details.

Please notice, I am able to reproduce the issue as you mentioned by using the simplest lines of code. I found Aspose.BarCode does not read barcode from “Sample-check-3.jpg” image although it can read MICR code on another image “Sample-check-2.jpg”:
e.g.
Sample code:

var bmp1 = new Bitmap("e:\\test2\\Sample-check-3.jpg");
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader1 = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(bmp1, Aspose.BarCode.BarCodeRecognition.DecodeType.AllSupportedTypes))
{
     Console.WriteLine(reader1.ReadBarCodes().Length);//0
     foreach (Aspose.BarCode.BarCodeRecognition.BarCodeResult result1 in reader1.ReadBarCodes())
     {
         // Read symbology type and code text
         Console.WriteLine("Symbology Type: " + result1.CodeType);
         Console.WriteLine("CodeText: " + result1.CodeText);
     }
}

I have logged a ticket with an id “BARCODENET-38244” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.