6.5 Key Segment
About1 Introduction2 Image Recognition3 TransApplet4 API5 Interface6 Input7 Image Display8 Preprocessing9 Processing10 Normalization11 Parameter Class12 Image Signatures13 Unsupervised Filters14 BioFilters15 NeuralFilters16 Dynamic Library17 NeuralNet Filter18 Parameters19 Input Options20 Database Input21 Video Input22  Live Video Input23  Counting & Tracking24  Counting 25  Batch Job26 ImageFinder for DOS27 ImageHunt 28 Support Packages

6.1 Class Name 
6.2 Class Overview 
6.3 Chapter Project 
6.4 Class Link 
6.5 Key Segment 
6.6 Search Source 
[Home][6 Input][6.5 Key Segment]

 

6.5   Key Segment

We will add a class, “Input”, in the project. We will implement the input buttons in this class. In this way, the main class is simpler. We will declare an object, input, as follows:

      Input input;

      public Form1()

              {

                  InitializeComponent();

                  input = new Input (this);

              }

We can double click the Key Segment buttons to complete the programming:

      private void button1_Click(object sender, System.EventArgs e)

              {

                  input.keySegment();

              }

which in turn, calls a function in the following class:

      public class Input

          {

              Form1 f;

              public Attrasoft.TransApplet70.Input70.Input70 in70 ;

              internal Bitmap bTrain;

              internal string softwareDir = Application.StartupPath + '\\' ;

          

              public Input(Form1 f1)

              {

                  f = f1;

                  in70 = new Attrasoft.TransApplet70.Input70.Input70 ( f.richTextBox1 );

              }

       

              void appendText (string s)

              {

                  f.richTextBox1.AppendText ( s);

              }

       

              public bool keySegment()

              {

                  if ( f.openFileDialog1.ShowDialog () != DialogResult.OK )

                      return false;

       

                  string fileName = f.openFileDialog1.FileName;

                  try

                  {

                      bTrain =new Bitmap (fileName);

                      f.pictureBox1.Image = bTrain;

                      f.textBox1.Text = fileName ;

                      f.richTextBox1.AppendText  ( "Display Key Segment:\n " + fileName +"\n");

                  }

                  catch

                  {

                      appendText ("Invalid key image !\n");

                      return false;

                  }

                  return true;

              }//keySegment()

      }

The first section of code opens a file dialog so the user can select a file:

      if ( f.openFileDialog1.ShowDialog () != DialogResult.OK )

              return false;

The next section of code gets the selected key:

      string fileName = f.openFileDialog1.FileName;

The last section of code creates an image and displays the image:

      bTrain =new Bitmap (fileName);

          f.pictureBox1.Image = bTrain;

          f.textBox1.Text = fileName ;

          f.richTextBox1.AppendText ( "Display Key Segment:\n " + fileName +"\n");

 

[Home][About][1 Introduction][2 Image Recognition][3 TransApplet][4 API][5 Interface][6 Input][7 Image Display][8 Preprocessing][9 Processing][10 Normalization][11 Parameter Class][12 Image Signatures][13 Unsupervised Filters][14 BioFilters][15 NeuralFilters][16 Dynamic Library][17 NeuralNet Filter][18 Parameters][19 Input Options][20 Database Input][21 Video Input][22 Live Video Input][23 Counting & Tracking][24 Counting ][25 Batch Job][26 ImageFinder for DOS][27 ImageHunt ][28 Support Packages]

Copyright (c) 2006 - 2007 Attrasoft. All rights reserved.

gina@attrasoft.com