com.aspose.omr

Class OmrEngine



  • public class OmrEngine
    extends Object

    The main entry point for the users of the library. It collects all data necessary for data extractions.


     
    OmrImage image = OmrImage.load(imageFile); // image path
    OmrTemplate template = OmrTemplate.load("template.amr"); // template path
    OmrEngine engine = new OmrEngine(template);
    OmrProcessingResult result = engine.extractData(new OmrImage[]{image});
     

    • Constructor Detail

      • OmrEngine

        public OmrEngine(OmrTemplate template)

        Initializes a new instance of the OmrEngine class.

        Parameters:
        template - An instance of OmrTemplate to be used for data extraction.
      • OmrEngine

        public OmrEngine(OmrTemplate template,
                 ProcessingPipeline pipeline)

        Initializes a new instance of the OmrEngine class.

        Parameters:
        template - An instance of OmrTemplate to be used for data extraction.
        pipeline - An instance of ProcessingPipeline that contains image processing algorithms used for preprocessing of a scanned image before data extraction.
    • Method Detail

      • changeProcessingPipeline

        public void changeProcessingPipeline(ProcessingPipeline newPipeline)

        Replaces the image processing pipeline with a new one.

        Parameters:
        newPipeline - The new pipeline.
      • extractData

        public OmrProcessingResult extractData(OmrImage[] documentImages)

        Extracts data from a scanned OMR sheets.

        Parameters:
        documentImages - Collection of scanned pages, according to the template.
        Returns:
        An instance of OmrProcessingResult that contains data extracted from the sheet.


         
        OmrImage image = OmrImage.load(imageFile); // image path
        OmrTemplate template = OmrTemplate.load("template.amr"); // template path
        OmrEngine engine = new OmrEngine(template);
        OmrProcessingResult result = engine.extractData(new OmrImage[]{image});
         

      • getConfiguration

        public OmrConfig getConfiguration()

        Gets global configuration for OMR extraction algorithm.

      • getProcessingPipeline

        public ProcessingPipeline getProcessingPipeline()

        Gets an instance of ProcessingPipeline that contains image processing algorithms used for preprocessing of a scanned image before data extraction.

      • getSkewCorrectionEnabled

        public boolean getSkewCorrectionEnabled()

        Gets a value indicating whether Skew Correction algorithm is enabled

      • getSkewDegree

        public double getSkewDegree(OmrImage image)

        Calculates skew degree of an image without making any changes to it

        Parameters:
        image - Image to process
        Returns:
        Image skew degree
      • getTemplate

        public OmrTemplate getTemplate()

        Gets a data template that describes data structure of an OMR sheet.

      • rotateImage

        public OmrImage rotateImage(OmrImage image,
                           double degree)

        Rotates an image for a specified degree

        Parameters:
        image - Image to process
        degree - Rotation degree
      • runSkewCorrection

        public void runSkewCorrection(OmrImage[] image)

        Processes an OmrImage with skew correction algorithm.

        Parameters:
        image - Image to process
      • setConfiguration

        public void setConfiguration(OmrConfig value)

        Sets global configuration for OMR extraction algorithm.

      • setSkewCorrectionEnabled

        public void setSkewCorrectionEnabled(boolean value)

        Sets a value indicating whether Skew Correction algorithm is enabled

      • setTemplate

        public void setTemplate(OmrTemplate value)

        Sets a data template that describes data structure of an OMR sheet.