A unique image identifier of the created image object. You can take advantages of the GdPictureImaging class and its methods to obtain this identifier.
Example





In This Topic

SetImage Method (GdPictureSegmenter)

In This Topic
Sets up the specified image object, so that it is subsequently used when you start the next segmentation process. This step is mandatory before running any segmentation.

This aproach permits you to highly improve performance when running multiple subsequent segmentation processes on the same image.

Syntax
'Declaration
 
Public Function SetImage( _
   ByVal ImageID As Integer _
) As GdPictureStatus
public GdPictureStatus SetImage( 
   int ImageID
)
public function SetImage( 
    ImageID: Integer
): GdPictureStatus; 
public function SetImage( 
   ImageID : int
) : GdPictureStatus;
public: GdPictureStatus SetImage( 
   int ImageID
) 
public:
GdPictureStatus SetImage( 
   int ImageID
) 

Parameters

ImageID
A unique image identifier of the created image object. You can take advantages of the GdPictureImaging class and its methods to obtain this identifier.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK

We strongly recommend always checking this status first.

Remarks
Please note that setting up an image is a mandatory step before running any segmentation process. This approach allows you to take all benefits of the speed optimization when running the required image segmentation.

This method requires the OCR component to run.

Example
How to set the image you want to process and how to subsequently run the segmentation process on this image.
Dim caption As String = "Example: SetImage"
Using gdpictureSegmenter As GdPictureSegmenter = New GdPictureSegmenter()
    'Set up the image you want to process.
    Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
        'The standard open file dialog displays to allow you to select the file.
        Dim image As Integer = gdpictureImaging.CreateGdPictureImageFromFile("")
        If (gdpictureImaging.GetStat() = GdPictureStatus.OK) AndAlso
           (gdpictureSegmenter.SetImage(image) = GdPictureStatus.OK) Then
            'Run the segmentation process.
            Dim result As String = gdpictureSegmenter.RunSegmentation()
            If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                'Continue ...
            Else
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption)
            End If
            'Release the used image.
            gdpictureImaging.ReleaseGdPictureImage(image)
        Else
            MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption)
        End If
    End Using
    'Release resources.
    gdpictureSegmenter.ReleaseSegmentationResults()
End Using
string caption = "Example: SetImage";
using (GdPictureSegmenter gdpictureSegmenter = new GdPictureSegmenter())
{
    //Set up the image you want to process.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        //The standard open file dialog displays to allow you to select the file.
        int image = gdpictureImaging.CreateGdPictureImageFromFile("");
        if ((gdpictureImaging.GetStat() == GdPictureStatus.OK) &&
            (gdpictureSegmenter.SetImage(image) == GdPictureStatus.OK))
        {
            //Run the segmentation process.
            string result = gdpictureSegmenter.RunSegmentation();
            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
            {
                //Continue ...
            }
            else
            {
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
            }
            //Release the used image.
            gdpictureImaging.ReleaseGdPictureImage(image);
        }
        else
            MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption);
    }
    //Release resources.
    gdpictureSegmenter.ReleaseSegmentationResults();
}
See Also