How To Find 2nd Closest Image

Discussions about Automatic Document Recognition in GdPicture.NET.
Post Reply
PeterH
Posts: 6
Joined: Sat Jul 24, 2010 11:08 am

How To Find 2nd Closest Image

Post by PeterH » Sat Oct 02, 2010 10:07 am

Two questions:

Is there a way to find the second closest template? Maybe find closest, delete that template, then execute ADRGetCloserTemplate... again?

Did you intend this ADR only to tell apart document types or has it been designed to distinguish, for example, a purchase order from one customer compared to a purchase order from another customer?

User avatar
Loïc
Site Admin
Posts: 5586
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How To Find 2nd Closest Image

Post by Loïc » Thu Oct 07, 2010 4:25 pm

Hi Peter,
Is there a way to find the second closest template?
Yes, you have to use the ADRGetLastConfidenceFromTemplate() method with all templates and use the 2nd highest value.
Did you intend this ADR only to tell apart document types or has it been designed to distinguish, for example, a purchase order from one customer compared to a purchase order from another customer?
The engine is designed to make distinction between document content. For example, you should be able to distinguish 2 different invoices if these invoices have 2 different logos.

Hope this helps !

loïc

PeterH
Posts: 6
Joined: Sat Jul 24, 2010 11:08 am

Re: How To Find 2nd Closest Image

Post by PeterH » Tue Oct 12, 2010 6:55 pm

Thx. I didn't entirely follow your reply.

Code: Select all

'Now, we will try to identify an image.
nCloserTemplate = oGdPictureImaging.ADRGetCloserTemplateForFile("document.tif")
ADRGetCloserTemplate will always find the closest. Do I have to delete it from the configuration and then repeat the statement to get the 2nd closest?

I don't otherwise understand how to use ADRGetLastConfidenceFromTemplate because that is only returned when a ADRGetCloserTemplate has been executed and that statement will always find the same one each time unless I change the configuration.

Thx

User avatar
Loïc
Site Admin
Posts: 5586
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How To Find 2nd Closest Image

Post by Loïc » Wed Oct 13, 2010 10:13 am

Hi,

Please find a code snippet demonstrating how to get last confidence for all templates (just 2 in the snippet but you can extend the number).

Code: Select all

        Dim oGdPictureImaging As New GdPicture.GdPictureImaging

        oGdPictureImaging.SetLicenseNumber("XXX")
        Dim ImageID1 As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("C:\test.tif")
        Dim TemplateID1 As Integer = oGdPictureImaging.ADRCreateTemplateFromGdPictureImage(ImageID1)
        oGdPictureImaging.ReleaseGdPictureImage(ImageID1)
        Dim ImageID2 As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("C:\test2.tif")
        Dim TemplateID2 As Integer = oGdPictureImaging.ADRCreateTemplateFromGdPictureImage(ImageID2)
        oGdPictureImaging.ReleaseGdPictureImage(ImageID2)


        Dim ImageIDTest As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("C:\test3.tif")
        oGdPictureImaging.ADRGetCloserTemplateForGdPictureImage(ImageIDTest) 'starts ADR process
        oGdPictureImaging.ReleaseGdPictureImage(ImageIDTest)


        MsgBox("Confidence for TemplateID1 " & Str(oGdPictureImaging.ADRGetLastConfidenceFromTemplate(TemplateID1)))
        MsgBox("Confidence for TemplateID2 " & Str(oGdPictureImaging.ADRGetLastConfidenceFromTemplate(TemplateID2)))

        oGdPictureImaging.ADRDeleteTemplate(TemplateID1)
        oGdPictureImaging.ADRDeleteTemplate(TemplateID2)
Hope this will be a bit more clear !

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest