Browse our Products

Aspose.OMR for .NET 21.2 Release Notes

All Changes

KeySummaryCategory
OMRNET-122Add Bubble radiusNew Feature
OMRNET-123Add distance between bubblesNew Feature
OMRNET-125Implement Font controlNew Feature
OMRNET-126Recognition from the streamNew Feature
OMRNET-135Batch recognitionNew Feature

Public API and Backwards Incompatible Changes

Added APIs:

TypeTitle
MethodAspose.OMR.Api.TemplateProcessor.RecognizeImage(System.IO.MemoryStream,System.Int32)
MethodAspose.OMR.Api.TemplateProcessor.RecognizeFolder(System.String,System.Int32)

Updated APIs:

No Changes

Removed APIs:

No Changes

Usage Example for Recognition from the stream

using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using Aspose.OMR;
using Aspose.OMR.Api;
using Aspose.OMR.Generation;
using Aspose.OMR.Model;

namespace ProgramOMR
{
    static void Main(string[] args)
    {
        // Create license
        SetLicense();   

        // Recognize method
        Recognize();
    }

    private static void SetLicense()
    {
        // Set license 
        License lic = new License();
        lic.SetLicense(@"D:\ProgramOMR\Properties\Aspose.Total.lic");
    }

    public static void Recognize()
    {
        // Get template for recognize
        string templatePath = @"D:\ProgramOMR\Recognize\Sheet_200_3_xl.omr";

        // Get image for recognize
        string imagePath = @"D:\ProgramOMR\Recognize\test.jpg";

        OmrEngine engine = new OmrEngine();

        // Set template for recognize
        TemplateProcessor templateProcessor = engine.GetTemplateProcessor(templatePath);

        using (Image image = Image.FromFile(imagePath))
        {
            using (MemoryStream ms = new MemoryStream())
            {
                image.Save(ms, image.RawFormat);
                ms.Flush();

                // Recognize image
                RecognitionResult result = templateProcessor.RecognizeImage(ms);

                var stringRes = result.GetCsv();
                File.WriteAllText(
                @"D:\ProgramOMR\Recognize\" +
                Path.GetFileNameWithoutExtension(imagePath) + ".csv", stringRes);
            }
        }
    }
}

Usage Example for Batch recognition

    public static void Recognize()
    {
        // Get template for recognize
        string templatePath = @"D:\ProgramOMR\Recognize\Sheet_200_3_xl.omr";

        // Get folder contains images for recognize
        string folderPath = @"D:\ProgramOMR\Recognize\images";

        OmrEngine engine = new OmrEngine();

        // Set template for recognize
        TemplateProcessor templateProcessor = engine.GetTemplateProcessor(templatePath);

        // Recognize images from folder
        RecognitionResult[] result = templateProcessor.RecognizeFolder(folderPath);

        for (int i = 0; i < result.Length; i++)
        {
            var stringRes = result[i].GetCsv();
            File.WriteAllText(
            @"D:\OMR\Recognize\" +
            Path.GetFileNameWithoutExtension(result[i].ImagePath) + ".csv", stringRes);
        }
    }

Example for set bubble size enum (small, normal, large, extralarge) on txt file

?grid=ID
    bubble_size=small

Example for set vertical margin between bubbles on txt file

?grid=ID
    bubble_size=extralarge
    vertical_margin=28

Example for set global settings for generate on txt file

?settings=global

Example for set font size on txt file

?settings=global
    font_size=15

Example for set font style (Bold, Italic, Regular, Strikeout, Underline) on txt file

?text=Name__________________________________ Date____________
    font_style=Bold

Example for set font family on txt file

?text=Sign________________________________
    font_family=Comic Sans MS