Example





In This Topic

InputValue Property (GdPictureSegmenter)

In This Topic
Specifies the input value that is required to segment a word. Expected value is a string containing the text/word/character you wish to segment.
Syntax
'Declaration

 

Public Property InputValue As String
public string InputValue {get; set;}
public read-write property InputValue: String; 
public function get,set InputValue : String
public: __property string* get_InputValue();

public: __property void set_InputValue( 

   string* value

);
public:

property String^ InputValue {

   String^ get();

   void set (    String^ value);

}
Example
Segmenting a word given its value.
using (GdPictureSegmenter gdpictureSegmenter = new GdPictureSegmenter())

{

    gdpictureSegmenter.SegmentationMode= SegmentationMode.WordLayout;

    gdpictureSegmenter.InputValue = "words";

    //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("d:\\wordimage.png");

        if ((gdpictureImaging.GetStat() == GdPictureStatus.OK) &&

            (gdpictureSegmenter.SetImage(image) == GdPictureStatus.OK) &&

            (gdpictureSegmenter.SetROI(10,10,55,55)== GdPictureStatus.OK))

        {

            //Run the segmentation process.

            string result = gdpictureSegmenter.RunSegmentation();

            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)

            {

               //You can do your another stuff with gdpictureSegmenter here.

            }

            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);

        }

    }

}
See Also