GdPicture.NET Reference Guide
ADRGetCloserTemplateForGdPictureImage Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : ADRGetCloserTemplateForGdPictureImage Method
The GdPicture Image.
Performs a Documents Recognition Operation from a GdPicture image and returns the Document Identifier Template ID which has the best similar content.
Syntax
'Declaration
 
Public Function ADRGetCloserTemplateForGdPictureImage( _
   ByVal ImageID As Integer _
) As Integer
public int ADRGetCloserTemplateForGdPictureImage( 
   int ImageID
)
public function ADRGetCloserTemplateForGdPictureImage( 
    ImageID: Integer
): Integer; 
public function ADRGetCloserTemplateForGdPictureImage( 
   ImageID : int
) : int;
public: int ADRGetCloserTemplateForGdPictureImage( 
   int ImageID
) 
public:
int ADRGetCloserTemplateForGdPictureImage( 
   int ImageID
) 

Parameters

ImageID
The GdPicture Image.

Return Value

The Template ID which has the best similar content to the specified image.
Example
How to create document templates and identify the one which has the closest similar content to an image file.
Dim TemplateID1 As Integer, TemplateID2 As Integer
Dim nCloserTemplate As Integer
Dim nImage as Integer
'We create the first template from an image
TemplateID1 = oGdPictureImaging.ADRCreateTemplateFromFile("template1.tif")
If TemplateID1 = 0 Then
   MessageBox.Show("Can't create TemplateID1 " + "Error number: " + oGdPictureImaging.GetStat().ToString())
End If
'We create the second template from an other kind of image
TemplateID2 = oGdPictureImaging.ADRCreateTemplateFromFile("template2.tif")
If TemplateID2 = 0 Then
   MessageBox.Show("Can't create TemplateID2 " + "Error number: " + oGdPictureImaging.GetStat().ToString())
End If
'Now, we will try to identify an image.
nImage = CreateGdPictureImageFromFile("document.tif")
nCloserTemplate = oGdPictureImaging.ADRGetCloserTemplateForGdPictureImage("document.tif")
Select Case nCloserTemplate
Case TemplateID1
MessageBox.Show("This image seems to get best similar content as TemplateID1. Confidence is: " + oGdPictureImaging.ADRGetLastConfidence().ToString() + " %")
Case TemplateID2
MessageBox.Show("This image seems to get best similar content as TemplateID2. Confidence is: " + oGdPictureImaging.ADRGetLastConfidence().ToString() + " %")
End Select
oGdPictureImaging.ReleaseGdPictureImage(nImage)
'Release created templates from memory
oGdPictureImaging.ADRDeleteTemplate (TemplateID1)
oGdPictureImaging.ADRDeleteTemplate (TemplateID2)
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members