GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureSegmenter Class / ReleaseSegmentationResult Method
A unique result identifier of the executed segmentation process obtained by the GdPictureSegmenter.RunSegmentation method.
Example





In This Topic
ReleaseSegmentationResult Method (GdPictureSegmenter)
In This Topic
Releases a segmentation result specified by its unique identifier. Each segmentation result, identifiable by its unique ID, is internally attached to that GdPictureSegmenter object, which has executed the segmentation process. By disposing of the current GdPictureSegmenter object you also release all attached segmentation results.
Syntax
'Declaration
 
Public Function ReleaseSegmentationResult( _
   ByVal SegmentationResultID As String _
) As GdPictureStatus
public GdPictureStatus ReleaseSegmentationResult( 
   string SegmentationResultID
)
public function ReleaseSegmentationResult( 
    SegmentationResultID: String
): GdPictureStatus; 
public function ReleaseSegmentationResult( 
   SegmentationResultID : String
) : GdPictureStatus;
public: GdPictureStatus ReleaseSegmentationResult( 
   string* SegmentationResultID
) 
public:
GdPictureStatus ReleaseSegmentationResult( 
   String^ SegmentationResultID
) 

Parameters

SegmentationResultID
A unique result identifier of the executed segmentation process obtained by the GdPictureSegmenter.RunSegmentation method.

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 be aware, that each segmentation result is internally linked to the GdPictureSegmenter object, that has executed the segmentation process.
Example
How to release particular segmentation results.
Dim caption As String = "Example: ReleaseSegmentationResult"
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
            'Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents4
            'Run the segmentation process.
            Dim resultID As String = "ConnectedComponents"
            gdpictureSegmenter.RunSegmentation(resultID)
            If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                'Check the results ...
                Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resultID)
                'Continue ...
            Else
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption)
            End If
            'Release previous resources.
            gdpictureSegmenter.ReleaseSegmentationResult(resultID)
            'Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents8
            'Run the segmentation process.
            gdpictureSegmenter.RunSegmentation(resultID)
            If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                'Check the results ...
                Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resultID)
                '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)
            'Release resources.
            gdpictureSegmenter.ReleaseSegmentationResult(resultID)
        Else
            MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption)
        End If
    End Using
End Using
string caption = "Example: ReleaseSegmentationResult";
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))
        {
            //Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents4;
            //Run the segmentation process.
            string resultID = "ConnectedComponents";
            gdpictureSegmenter.RunSegmentation(resultID);
            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
            {
                //Check the results ...
                int blockCount = gdpictureSegmenter.GetBlockCount(resultID);
                //Continue ...
            }
            else
            {
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
            }
            //Release previous resources.
            gdpictureSegmenter.ReleaseSegmentationResult(resultID);
            //Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents8;
            //Run the segmentation process.
            gdpictureSegmenter.RunSegmentation(resultID);
            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
            {
                //Check the results ...
                int blockCount = gdpictureSegmenter.GetBlockCount(resultID);
                //Continue ...
            }
            else
            {
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
            }
            //Release the used image.
            gdpictureImaging.ReleaseGdPictureImage(image);
            //Release resources.
            gdpictureSegmenter.ReleaseSegmentationResult(resultID);
        }
        else
            MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption);
    }
}
See Also