HI, Have a scanner that will scan in documents into a database and looking to match each against a master template list saved to a db. I have 3-4 templates saved and when i compare each document it always comes back matching the same template.
Does it matter the size of the template used to compare against? If the scanned doc is 2000x2400 what size should the template be? Does that relate to the confidence level? Also i am cropping the white space from templates and scanned docs for comparision, this the right thing to do?
Sample code below:
# HOW TO FIND TEMPLATE WITH HIGHEST CONFIDENCE - TEMPLATES ALREADY LOADED#
Dim WorkDirName As String = "WORKING-DIRECTORY"
Dim ImageIDCROPPED As Integer
Dim iCropFileName As String = Nothing
Dim iTemplFound As String = Nothing
If oGdPictureImaging.ADRGetTemplateCount() > 0 Then
Dim bTemplateConfigOK As Boolean = True
For i As Integer = 1 To oGdPictureImaging.ADRGetTemplateCount
TemplateID = oGdPictureImaging.ADRGetTemplateID(i)
If oGdPictureImaging.ADRGetTemplateImageCount(TemplateID) = 0 Then
MsgBox("Please assign image(s) to template.")
bTemplateConfigOK = False
Exit For
End If
'MsgBox("Images for Template: " & oGdPictureImaging.ADRGetTemplateImageCount(TemplateID))
Next
If bTemplateConfigOK Then
' REMOVE WHITE SPACE FROM SCANNED DOCUMENT ----------------------------------------------
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile(DocName) ' DOCNAME Is path to scanned document
If (oGdPictureImaging.IsBlank(ImageID)) Then
MsgBox("IMAGE IS BLANK!")
End If
' CROP WHITE BORDERS FROM TEMPLATE -------------------------------------------------------------
oGdPictureImaging.CropWhiteBorders(ImageID, 98, 3)
iCropFileName = WorkDirName & System.IO.Path.GetFileNameWithoutExtension(DocName) & ".jpg"
oGdPictureImaging.SaveAsJPEG(ImageID, WorkDirName & System.IO.Path.GetFileNameWithoutExtension(DocName) & ".jpg")
'status = oGdPictureImaging.SaveAsJPEG(ImageID, strPath & iNewFileName)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
ImageIDCROPPED = oGdPictureImaging.CreateGdPictureImageFromFile(iCropFileName)
If ImageIDCROPPED <> 0 Then
Dim closerTemplateID As Integer = oGdPictureImaging.ADRGetCloserTemplateForGdPictureImage(ImageIDCROPPED)
If closerTemplateID <> 0 Then
Dim templateName As String = oGdPictureImaging.ADRGetTemplateTag(closerTemplateID)
iTemplFound = ">> Confidence%: " & oGdPictureImaging.ADRGetLastConfidence().ToString
iTemplFound += " ID#: " & oGdPictureImaging.ADRGetTemplateID(closerTemplateID).ToString
iTemplFound += " Dealer#: " & oGdPictureImaging.ADRGetTemplateTag(closerTemplateID).ToString
'If MsgBox("Template identified: " + templateName + " (" + closerTemplateID.ToString + ")" + Chr(13) + _
' "Accuracy: " + Accuracy.ToString() + Chr(13) + Chr(13) + _
' "Do you want to get extended results?", "results", vbYesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
MsgBox(iTemplFound)
fullResults = ""
For i As Integer = 1 To oGdPictureImaging.ADRGetTemplateCount()
TemplateID = oGdPictureImaging.ADRGetTemplateID(i)
templateName = oGdPictureImaging.ADRGetTemplateTag(TemplateID)
Accuracy = Math.Round(oGdPictureImaging.ADRGetLastConfidenceFromTemplate(TemplateID), 2)
fullResults += "Accuracy: " + Accuracy.ToString + " Template: " + templateName + " (" + TemplateID.ToString + ")" + Chr(13)
Next
MsgBox(fullResults)
'End If
Else
MsgBox("Error during template matching. Status: " + oGdPictureImaging.GetStat().ToString())
End If
oGdPictureImaging.ReleaseGdPictureImage(ImageIDCROPPED)
Else
MsgBox("Can't open selected image.")
End If
End If
Else
MsgBox("Please first create template.")
End If
Low Confidence Using ADR
Re: Low Confidence Using ADR
Hello,
Please share document used with our team to diagnose such problem and determine if the document recognition engine can be improved.
For such process please open a ticket into our helpdesk that can be reached here: https://www.gdpicture.com/support/getting-support-from-our-team
Kind regards,
Loïc
Please share document used with our team to diagnose such problem and determine if the document recognition engine can be improved.
For such process please open a ticket into our helpdesk that can be reached here: https://www.gdpicture.com/support/getting-support-from-our-team
Kind regards,
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest