GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureSegmenter Class
Members Example





In This Topic
GdPictureSegmenter Class
In This Topic
The GdPictureSegmenter class offers the comprehensive image segmentation support. It is used as a wrapper class to allow you easily segment your image-based documents into regions and to find out required results in one place.

In general, the image segmentation simply means a thresholding of your image into various areas, like blocks of text, graphics or images.

Syntax
'Declaration
 
Public NotInheritable Class GdPictureSegmenter 
public sealed class GdPictureSegmenter 
public class GdPictureSegmenter sealed; 
public sealed class GdPictureSegmenter 
public __gc __sealed class GdPictureSegmenter 
public ref class GdPictureSegmenter sealed 
Remarks
You need to create an object of this class to fully perform the image segmentation on your files. This object allows you to set the required image for the segmentation and subsequently it enables you to very easily find out the segmentation results.
Example
How to use the instance of the GdPictureSegmenter class to process the image segmentation on your image-based file.
Dim caption As String = "Example: GdPictureSegmenter class"
Using gdpictureSegmenter As GdPictureSegmenter = New GdPictureSegmenter()
 
    'Set up the image you want to process.
    Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
        Dim image As Integer = gdpictureImaging.CreateGdPictureImageFromFile("")
        'Check the status ...
 
        Dim status As GdPictureStatus = gdpictureSegmenter.SetImage(image)
        If status = GdPictureStatus.OK Then
 
            'Run the segmentation process.
            Dim resID As String = gdpictureSegmenter.RunSegmentation()
            If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                'Check the results.
                Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resID)
                'Continue ...
            Else
                MessageBox.Show("The segmentation process has failed with the status: " & gdpictureSegmenter.GetStat().ToString(), caption)
            End If
 
            'Continue ...
        End If
 
        'Release image resources.
        gdpictureImaging.ReleaseGdPictureImage(image)
    End Using
 
    'Release segmentation resources.
    gdpictureSegmenter.ReleaseSegmentationResults()
End Using
string caption = "Example: GdPictureSegmenter class";
using (GdPictureSegmenter gdpictureSegmenter = new GdPictureSegmenter())
{
    //Set up the image you want to process.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        int image = gdpictureImaging.CreateGdPictureImageFromFile("");
        //Check the status ...
 
        GdPictureStatus status = gdpictureSegmenter.SetImage(image);
        if (status == GdPictureStatus.OK)
        {
            //Run the segmentation process.
            string resID = gdpictureSegmenter.RunSegmentation();
            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
            {
                //Check the results.
                int blockCount = gdpictureSegmenter.GetBlockCount(resID);
                //Continue ...
            }
            else
            {
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
            }
 
            //Continue ...
        }
 
        //Release image resources.
        gdpictureImaging.ReleaseGdPictureImage(image);
    }
    //Release segmentation resources.
    gdpictureSegmenter.ReleaseSegmentationResults();
}
Inheritance Hierarchy

System.Object
   GdPicture14.GdPictureSegmenter

See Also