|
|
|
|
6.5 Key SegmentWe 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. |