Reference Guide
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 oGdPictureSegmenter As GdPictureSegmenter = New GdPictureSegmenter()
     
        'Set up the image you want to process.
        Using oGdPictureImage As GdPictureImaging = New GdPictureImaging()
            Dim image As Integer = oGdPictureImage.CreateGdPictureImageFromFile("")
            'Check the status ...
     
            Dim status As GdPictureStatus = oGdPictureSegmenter.SetImage(image)
            If status = GdPictureStatus.OK Then
     
                'Run the segmentation process.
                Dim resID As String = oGdPictureSegmenter.RunSegmentation()
                If oGdPictureSegmenter.GetStat() = GdPictureStatus.OK Then
                    'Check the results.
                    Dim blockCount As Integer = oGdPictureSegmenter.GetBlockCount(resID)
                    'Continue ...
                Else
                    MessageBox.Show("The segmentation process has failed with the status: " & oGdPictureSegmenter.GetStat().ToString(), caption)
                End If
     
                'Continue ...
            End If
     
            'Release image resources.
            oGdPictureImage.ReleaseGdPictureImage(image)
        End Using
     
        'Release segmentation resources.
        oGdPictureSegmenter.ReleaseSegmentationResults()
    End Using
    string caption = "Example: GdPictureSegmenter class";
    using (GdPictureSegmenter oGdPictureSegmenter = new GdPictureSegmenter())
    {
        //Set up the image you want to process.
        using (GdPictureImaging oGdPictureImage = new GdPictureImaging())
        {
            int image = oGdPictureImage.CreateGdPictureImageFromFile("");
            //Check the status ...
     
            GdPictureStatus status = oGdPictureSegmenter.SetImage(image);
            if (status == GdPictureStatus.OK)
            {
                //Run the segmentation process.
                string resID = oGdPictureSegmenter.RunSegmentation();
                if (oGdPictureSegmenter.GetStat() == GdPictureStatus.OK)
                {
                    //Check the results.
                    int blockCount = oGdPictureSegmenter.GetBlockCount(resID);
                    //Continue ...
                }
                else
                {
                    MessageBox.Show("The segmentation process has failed with the status: " + oGdPictureSegmenter.GetStat().ToString(), caption);
                }
     
                //Continue ...
            }
     
            //Release image resources.
            oGdPictureImage.ReleaseGdPictureImage(image);
        }
        //Release segmentation resources.
        oGdPictureSegmenter.ReleaseSegmentationResults();
    }
    Inheritance Hierarchy

    System.Object
       GdPicture14.GdPictureSegmenter

    See Also