コミュニティ

image preprocessing

how can we crop or resize image? ABBY fine reader will set image size by default to get better quality?

For example my input images can be different sizes. Can Abbyy resize the images so that the accuracy can be increased?

 

 

Admin Oksana Serdyuk

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

7件のコメント

  • Avatar
    Permanently deleted user

    Hi Rama

    What have you tried so far? Can you please post your Java-code?

    The "PagePreprocessingParams Object" can help you a lot, see the documentation

    See also

    Tuning Parameters of Preprocessing, Analysis, Recognition, and Synthesis
    Working with Properties

     

     ABBYY FineReader Engine 11 API Reference

    PagePreprocessingParams Object (IPagePreprocessingParams Interface)

    This object is used for tuning different parameters of page preprocessing. Page preprocessing is performed before page analysis. This stage includes correction of page orientation, image inversion, and removal of geometrical distortions. A pointer to this object is passed as a member of the PageProcessingParams object into processing methods.

    The PagePreprocessingParams object is a persistent object. This means that the object's current state can be written to persistent storage: an area in the global memory or a disk file. Later, the object can be re-created by reading the object's state from persistent storage. The following methods provide persistence of the object: SaveToFile, LoadFromFile, SaveToMemory, and LoadFromMemory.

    Properties

    Name Type Description Application Engine, read-only Returns the Engine object. CorrectInvertedImage VARIANT_BOOL This property set to TRUE tells ABBYY FineReader Engine to detect whether the image is inverted (white text against black background). The text color is detected during page prerocessing, and if it differs from normal, ABBYY FineReader Engine automatically inverts the image.

    This property is FALSE by default.

    CorrectOrientation VARIANT_BOOL If this property is TRUE, the page orientation is detected during page prerocessing, and if it differs from normal, ABBYY FineReader Engine automatically rotates the image.

    Note: If this property is set to TRUE:

    • the TextTypes property of the RecognizerParams object cannot be set to TT_Handprinted;
    • the TrainUserPatterns property of the RecognizerParams object cannot be set to TRUE.

    This property is FALSE by default.

    CorrectShadowsAndHighlights ThreeStatePropertyValueEnum If this property is set to TSPV_Yes, the image preprocessing will include correction of excessive shadows and highlighting to improve recognition quality. This property is designed for use with photographs only.

    The default value of this property is TSPV_Auto.

    CorrectSkew ThreeStatePropertyValueEnum If this property is set to TSPV_Yes, image skew will be corrected during page preprocessing. The type of skew correction is defined by the CorrectSkewMode property.

    If this property is set to TSPV_No, the value of the CorrectSkewMode property is ignored.

    By default, this property is set to TSPV_Auto.

    CorrectSkewMode int Specifies the mode of skew correction. The value of this property is an OR superposition of the CorrectSkewModeEnum enumeration constants which denote the types of skew correction. 0 means do not correct skew.

    The value of this property is ignored, if the CorrectSkew property is set to TSPV_No.

    By default, this property is set to CSM_CorrectSkewByHorizontalText | CSM_CorrectSkewByVerticalText.

    GeometryCorrectionMode GeometryCorrectionModeEnum Specifies whether geometrical distortions (perspective on photos, curved lines from scanned books, etc.) should be removed during page preprocessing.

    This property is GCM_Auto by default.

    OrientationDetectionParams OrientationDetectionParams Provides access to the parameters of orientation detection.

    These parameters are ignored, if the value of the CorrectOrientation property is FALSE.

    ResolutionCorrectionMode ResolutionCorrectionModeEnum Specifies whether resolution of the image should be corrected during page preprocessing.

    This property is RCM_Auto by default, which means that if resolution of the image is suspicious, FineReader Engine should automatically detect image resolution and change it.

    Methods

    Name Description CopyFrom Initializes properties of the current object with values of similar properties of another object. LoadFromFile Restores the object contents from a file on disk. LoadFromMemory Restores the object contents from the global memory. SaveToFile Saves the object contents into a file on disk. SaveToMemory Saves the object contents into the global memory.

    Related objects

    Object Diagram

    Output parameter

    This object is the output parameter of the CreatePagePreprocessingParams method of the Engine object.

    Input parameter

    This object is passed as an input parameter to the following methods:

    Samples

    The object is used in the following demo tools: Camera OCR, Classification, Image Preprocessing.

    See also

    Tuning Parameters of Preprocessing, Analysis, Recognition, and Synthesis
    Working with Properties

     

    Best regards
    Koen de Leijer

    0
  • Avatar
    Permanently deleted user

    Hi Koen,

     

    what is the difference between skew and orientation?

    0
  • Avatar
    Permanently deleted user

    Hi Rama

    Your "new" question is not actually about resizing but is more likely to be extended in your other question:
    https://forum.ocrsdk.com/thread/skew-and-orientation/

    Basically, the main difference is
    - skew: a page/document that has been scanned al little skew
    - orientation(-detection) : landscape vs portrait - or detection of it - and/or automatically rotate
     
    See both image below:

    Skew:


    Orientation:

    OrientationCorrection: (ABBYY FineReader can rotate this page to show it correctly)


    Best regards
    Koen de Leijer

    0
  • Avatar
    Permanently deleted user

    // (c) 2018 ABBYY Production LLC // SAMPLES code is property of ABBYY, exclusive rights are reserved. // // DEVELOPER is allowed to incorporate SAMPLES into his own APPLICATION and modify it under // the terms of License Agreement between ABBYY and DEVELOPER. // ABBYY FineReader Engine 12 Sample // This sample shows basic steps of ABBYY FineReader Engine usage: // Initializing, opening image file, recognition and export. import com.abbyy.FREngine.*; import java.nio.file.*; public class Hello { public static void main( String[] args ) { try { Hello application = new Hello(); application.Run(); } catch( Exception ex ) { displayMessage( ex.getMessage() ); } } public void Run() throws Exception { // Load ABBYY FineReader Engine loadEngine(); try{ // Process with ABBYY FineReader Engine processWithEngine(); } finally { // Unload ABBYY FineReader Engine unloadEngine(); } } private void loadEngine() throws Exception { displayMessage( "Initializing Engine..." ); engine = Engine.InitializeEngine( SamplesConfig.GetDllFolder(), SamplesConfig.GetCustomerProjectId(), SamplesConfig.GetLicensePath(), SamplesConfig.GetLicensePassword(), "", "", false ); } private void processWithEngine() { try { // Setup FREngine setupFREngine(); // Process sample image processImage(); } catch( Exception ex ) { displayMessage( ex.getMessage() ); } } private void setupFREngine() { displayMessage( "Loading predefined profile..." ); engine.LoadPredefinedProfile( "DocumentConversion_Accuracy" ); // Possible profile names are: // "DocumentConversion_Accuracy", "DocumentConversion_Speed", // "DocumentArchiving_Accuracy", "DocumentArchiving_Speed", // "BookArchiving_Accuracy", "BookArchiving_Speed", // "TextExtraction_Accuracy", "TextExtraction_Speed", // "FieldLevelRecognition", // "BarcodeRecognition_Accuracy", "BarcodeRecognition_Speed", // "HighCompressedImageOnlyPdf", // "BusinessCardsProcessing", // "EngineeringDrawingsProcessing", // "Version9Compatibility", // "Default" } private void processImage() { // String imagePath = SamplesConfig.GetSamplesFolder() + "//home//DCXMprod//ABBYY//Samples//images//Charlotta_1.jpg"; String imagePath = SamplesConfig.GetSamplesFolder() + "images/skew/Doc_2.pdf"; try { // Don't recognize PDF file with a textual content, just copy it // Create document //engine.LoadPredefinedProfile("DocumentConversion_Accuracy"); //engine.CreateRecognizerParams().SetPredefinedTextLanguage("German"); //IEngine engine=null; //engine=Engine.GetEngineObject(SamplesConfig.GetDllFolder(),SamplesConfig.GetDeveloperSN()); //String profile=SamplesConfig.GetSamplesFolder() + "images/dff.ini"; //engine.LoadProfile(profile); IFRDocument document = engine.CreateFRDocument(); try { // Add image file to document displayMessage( "Loading image..." ); document.AddImageFile( imagePath, null, null ); //pages=document.getPages(); IDocumentProcessingParams docProcessingParams =engine.CreateDocumentProcessingParams(); IPageAnalysisParams tabParams=docProcessingParams.getPageProcessingParams().getPageAnalysisParams(); tabParams.setDetectText(true); // tabParams.setEnableTextExtractionMode(true); //tabParams.setAggressiveTableDetection(true); //tabParams.DetectTables=true; IXLExportParams xlparam=engine.CreateXLExportParams(); xlparam.setLayoutRetentionMode(XLSXLayoutRetentionModeEnum.XLLRM_ExactLines); xlparam.setTablesOnly(true); String texExportPath = SamplesConfig.GetSamplesFolder() + "images/skew/Doc_2ori.txt"; document.Export( texExportPath, FileExportFormatEnum.FEF_TextUnicodeDefaults, null); String xlExportPath = SamplesConfig.GetSamplesFolder() + "images/skew/Doc_2orie.xls"; document.Export( xlExportPath, FileExportFormatEnum.FEF_XLSX, xlparam); } finally { // Close document document.Close(); } } catch( Exception ex ) { displayMessage( ex.getMessage() ); } } private void unloadEngine() throws Exception { displayMessage( "Deinitializing Engine..." ); engine = null; Engine.DeinitializeEngine(); } private static void displayMessage( String message ) { System.out.println( message ); } private IEngine engine = null; }

    0
  • Avatar
    Permanently deleted user

     Hi

    check below code and input output.

     

    private void processImage() {

    // String imagePath = SamplesConfig.GetSamplesFolder() + "//home//DCXMprod//ABBYY//Samples//images//Charlotta_1.jpg";

     String imagePath = SamplesConfig.GetSamplesFolder() + "images/skew/Doc_2.pdf";

     

    try {

    // Don't recognize PDF file with a textual content, just copy it

     

     

    // Create document

     

    IFRDocument document = engine.CreateFRDocument();

     

    try {

    // Add image file to document

    displayMessage( "Loading image..." );

     

    document.AddImageFile( imagePath, null, null );

    //pages=document.getPages();

    IDocumentProcessingParams docProcessingParams =engine.CreateDocumentProcessingParams();

     

    IPageAnalysisParams tabParams=docProcessingParams.getPageProcessingParams().getPageAnalysisParams();

    tabParams.setDetectText(true);

                    tabParams.setEnableTextExtractionMode(true);

                    //tabParams.setAggressiveTableDetection(true);

                    //tabParams.DetectTables=true;

                    

                    //orientation

    IPagePreprocessingParams pageproparams=engine.CreatePagePreprocessingParams();

    pageproparams.setCorrectOrientation(true);

                    

                   

     

    IXLExportParams xlparam=engine.CreateXLExportParams();

    xlparam.setLayoutRetentionMode(XLSXLayoutRetentionModeEnum.XLLRM_ExactLines);

    xlparam.setTablesOnly(true);

     

     

    // Save results

     

     

    document.Process(docProcessingParams);

    //displayMessage( "Saving results..." );

     

     

    // Save results to pdf using 'balanced' scenario

     

     

     

    String texExportPath = SamplesConfig.GetSamplesFolder() + "images/skew/Doc_2ori.txt";

    document.Export( texExportPath, FileExportFormatEnum.FEF_TextUnicodeDefaults, null);

     

     

    String xlExportPath = SamplesConfig.GetSamplesFolder() + "images/skew/Doc_2orie.xls";

    document.Export( xlExportPath, FileExportFormatEnum.FEF_XLSX, xlparam);

    } finally {

    // Close document

    document.Close();

    }

    } catch( Exception ex ) {

    displayMessage( ex.getMessage() );

    }

    }

     

     

    0
  • Avatar
    Permanently deleted user

    Hi Rama

    Can you please edit both posts and place the Java-code within the block-quote tag?

    Thanks.

    Also, Your excel-sheet is not readble.

    Best regards
    Koen de Leijer

    PS. Here one of my examples:

                            /*
                    If orientation detection is performed during document processing
                    (IPagePreprocessingParams::CorrectOrientation property is TRUE), you can select fast
                    orientation detection mode: set the OrientationDetectionMode property of the
                    OrientationDetectionParams object to ODM_Fast.
                 */

                IDocumentProcessingParams dpp = engine.CreateDocumentProcessingParams();   
                dpp.getPageProcessingParams().getPagePreprocessingParams().setCorrectOrientation(true);


                //Agressive text-selection       dpp.getPageProcessingParams().getObjectsExtractionParams().setEnableAggressiveTextExtraction(true);
                dpp.getPageProcessingParams().getObjectsExtractionParams().setDetectTextOnPictures(true);

    0
  • Avatar
    Permanently deleted user

    I need to crop images with high quality because I want to upload images on my resume website. I want to gather some data from resume centers before this I need to read resume center reviews to write better resumes. I need to make resumes and upload images on my websites. Please help me to crop images with high quality.

    0

サインインしてコメントを残してください。