How To Find 2nd Closest Image
How To Find 2nd Closest Image
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?
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?
Re: How To Find 2nd Closest Image
Hi Peter,
Hope this helps !
loïc
Yes, you have to use the ADRGetLastConfidenceFromTemplate() method with all templates and use the 2nd highest value.Is there a way to find the second closest template?
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.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?
Hope this helps !
loïc
Re: How To Find 2nd Closest Image
Thx. I didn't entirely follow your reply.
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
Code: Select all
'Now, we will try to identify an image.
nCloserTemplate = oGdPictureImaging.ADRGetCloserTemplateForFile("document.tif")
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
Re: How To Find 2nd Closest Image
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).
Hope this will be a bit more clear !
Kind regards,
Loïc
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)
Kind regards,
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest