Good Morning, Im having slight confusion when trying to create a custom commoditiy for loyalty cards. I've read the developers handbook and I still have been able to figure it out. Please in your answer provide an example. Please illustrate; 1) Whats wrong with my code? 2)How does the path to the database work with the loyalty card finder 3)What data information should be stored in the database

Thank you!

private void processImage()
    {
        string imagePath = Path.Combine(Freconfig.GetSamplesFolder(), "homedepot2.jpg");

        // Create recognizer
        ReceiptCapture.IReceiptRecognizer recognizer = engineLoader.Engine.CreateReceiptRecognizer();

        ReceiptCapture.ICommodityTrainer loyalty = engineLoader.Engine.OpenCommodityTrainer("C:\\Users\\Jonathan Persaud\\Desktop\\trialRun\\loyaltycard", 1);//Step 1
        loyalty.CreateCommodityInfo("name", "SKU", "CouponName"); //Step 2
        loyalty.CreateEtalon("C:\\Users\\Jonathan Persaud\\Desktop\\trialRun\\loyaltycard");//Step 3

        ReceiptCapture.ICommodityEtalon commodityEt = engineLoader.Engine.OpenCommodityEtalon("C:\\Users\\Jonathan Persaud\\Desktop\\trialRun\\loyaltycard");//Using commodity Step 1

        try
        {

            // Add image file to recognizer
            displayMessage("Loading image...");
            recognizer.AddImageFile(imagePath, null);
            ReceiptCapture.IImageDocument imageDoc = recognizer.Receipts.Item(0).ImageDocument;
            imageDoc.CropImage();
            imageDoc.EnhanceLocalContrast();
            imageDoc.CorrectSkew(10);
            imageDoc.RemoveGarbage();

            // Recognize document
            displayMessage("Recognizing...");
            recognizer.Process(null);

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

            // Export the first recognized receipt
            if (recognizer.Receipts.Count > 0)
            {
                string exportPath = Path.Combine(Freconfig.GetSamplesFolder(), "ReceiptCapture.xml");
                recognizer.Receipts[0].ExportToXml(exportPath, null);

                // Open it in an external program
                System.Diagnostics.Process.Start(exportPath);
            }
        }
        catch (Exception error)
        {
            MessageBox.Show(this, error.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        finally
        {
            // Close recognizer
            recognizer.Close();
        }
    }

    private void processWithEngine()
    {
        try
        {
            // Setup Receipt Capture Engine
            setupReceiptCaptureEngine();

            // Process sample image
            processImage();
        }
        catch (Exception error)
        {
            MessageBox.Show(this, error.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

asked 01 Jul '16, 18:09

persaudJon's gravatar image

persaudJon
216

1

Hi, have you already seen the Line Item Lookup API Demo tool (the Samples folder -> Demo Tools -> Line Item Lookup API Demo)? It shows how to train a commodity model and use it to find the specific products in the receipt.

(04 Jul '16, 15:27) Oksana Serdyuk ♦♦

I dont seem to see that in my sample folder, is this tool used in the Receipt Capture SDK? and if not could you possibly point me a to link where I can reference this Line Item API tool.

Thank you!

(05 Jul '16, 17:39) persaudJon

Possible you use the beta version of the program, and this Demo tool was added to the official version of ABBYY Receipt Capture SDK 1 R1 GM, build#: 1.0.0.188. Please ask your sales manager to provide you with the link to download the new version.

(06 Jul '16, 16:58) Oksana Serdyuk ♦♦

That explains it!, I'll contact my sales manager now. Thank you for your help!

(06 Jul '16, 17:00) persaudJon
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×36
×9
×6

Asked: 01 Jul '16, 18:09

Seen: 1,142 times

Last updated: 06 Jul '16, 17:00

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal