You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > Automatic Document Recognition > ADRCreateTemplateEmpty Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.ADRCreateTemplateEmpty Method

Creates a new empty document identifier template. Then, you will to add images in this template using the ADRAddGdPictureImageToTemplate() function.

C#
public int ADRCreateTemplateEmpty();
Visual Basic
Public Function ADRCreateTemplateEmpty() As Integer
Returns

The created template ID if success else, -1 if fail. check the GetStat() function to get the reason on this result.

How to create document templates and identify the one which has the closer similar content than an image file.

Dim TemplateID1 As Integer, TemplateID2 As Integer
Dim ImageID1 As Integer, ImageID2 As Integer
Dim nCloserTemplate As Integer
 
'We create the first template from an image
TemplateID1 = oGdPictureImaging.ADRCreateTemplateEmpty
ImageID1 = oGdPictureImaging.CreateGdPictureImageFromFile("template1.tif")
If  oGdPictureImaging.ADRAddGdPictureImageToTemplate(TemplateID1, ImageID1) <> OK Then
   MsgBox "Can't add image to TemplateID1 " + "Error number: " + str(oGdPictureImaging.GetStat)
End If
 
'We create the second template from an other kind of image
 
TemplateID2 = oGdPictureImaging.ADRCreateTemplateEmpty
ImageID2 = oGdPictureImaging.CreateGdPictureImageFromFile("template2.tif")
 
If  oGdPictureImaging.ADRAddGdPictureImageToTemplate(TemplateID2, ImageID2) <> OK Then
   MsgBox "Can't add image to TemplateID2 " + "Error number: " + str(oGdPictureImaging.GetStat)
End If
 
 
'Now, we will try to identify an image.
nCloserTemplate = oGdPictureImaging.ADRGetCloserTemplateForFile("document.tif")
 
Select Case nCloserTemplate
       Case TemplateID1
            MsgBox "This image seems to get best similar content as TemplateID1. Confidence is: " + str(oGdPictureImaging.ADRGetLastConfidence) + " %"
       Case TemplateID2
            MsgBox "This image seems to get best similar content as TemplateID2. Confidence is: " + str(oGdPictureImaging.ADRGetLastConfidence) + " %"
End Select
 
 
'Release created templates from memory
oGdPictureImaging.ADRDeleteTemplate (TemplateID1)
oGdPictureImaging.ADRDeleteTemplate (TemplateID2)
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.