|
|
|
|
[Home][27 ImageHunt ][27.8 Step 3]
|
|
27.8 Step 3. Create Batch File27.8.1 Cookies or URLThe User will make three clicks:
The third click is the “Search” button, which will lead to a new web form. The code for the “Search” button is: private void Button1_Click(object sender, System.EventArgs e) { string fn = TextBox2.Text; SaveLocation = Server.MapPath("Data") + "\\" + fn; Response.Redirect ("Attrasoft_ImageHunt2.aspx" + "?p="+ SaveLocation); } The uploaded image is passed to the new web form, “Attrasoft_ImageHunt2.aspx”. You could choose cookies (Post Method): Session [ "theFileName" ] = SaveLocation; Or URL (Get Method): Response.Redirect ("Attrasoft_ImageHunt2.aspx" + "?p="+ SaveLocation); Obviously, we have chosen the URL to pass the location of the uploaded image. If you choose the Cookies, you must inform your client to accept cookies.
27.8.2 Create Batch FileAt this point, we are redirected to web form, “Attrasoft_ImageHunt2.aspx”. Upon starting this web form, the following code will call function, “start()”: private void Page_Load(object sender, System.EventArgs e) { start(); } The first thing “start()” will do is to create a batch file used by the ImageFinder for Dos: string master = "master.txt"; string parameterFile = "abm70.txt"; bool createFile () { StreamWriter sw; StreamReader sr; string sRead; int i = 0;
try { sr = new StreamReader ( matchLocation + master ); sw = new StreamWriter ( matchLocation + parameterFile );
i = 0; while ( sr.Peek () != -1 ) { sRead = sr.ReadLine (); if ( i == 3 ) { //sw.WriteLine ( "trainFileName=" + Session [ "theFileName" ] ); sw.WriteLine ( "trainFileName=" +Request.QueryString ["p"].ToString () ); } else sw.WriteLine (sRead); i++; } sw.Close (); sr.Close (); } catch ( Exception em ) { Label1.Text = em.ToString () +"\n"; return false; } return true; }//create file This function basically copies "master.txt” to "abm70.txt" line by line, with the exception of line 3: if ( i == 3 ) { //sw.WriteLine ( "trainFileName=" + Session [ "theFileName" ] ); sw.WriteLine ( "trainFileName=" +Request.QueryString ["p"].ToString () ); } This is where the ImageHunt learns where the new image is. There are several other minor things; we will omit them here.
[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. |