13.7 1:N Implementation
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

13.1 Filter Menu 
13.2 Filter API 
13.3 N-Signature 
13.4 N:N Design 
13.5 N:N Implementation 
13.6 1:N Design 
13.7 1:N Implementation 
[Home][13 Unsupervised Filters][13.7 1:N Implementation]

 

13.7   1:N  Matching Implementation

Double click menu item “Unsupervised/Matching/1:N (Key vs. a1.txt)” and enter:

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

            {

            bool b = this.mainMenuToAPI .unsupervised_Matching_1ToN

        textBox1.Text , dataDir + "a1.txt",     dataDir + "b1.txt" );

            }

Here, mainMenuToAPI is an object, which will implement all functions. As we discussed earlier, the main form simply links menu items to functions in the mainMenuToAPI object. The implementation is:

        public bool unsupervised_Matching_1ToN

                ( string key, string a1File, string b1File)

            {

            bool b = false;

                if ( ! System.IO .File .Exists (key) )

                    {

                        appendText ( "Please enter a valid Key!\n");

                        return false;

                    }

         

                b = this.signature_Key_Signature (key);

                if ( ! b )

                {

                    appendText ( "Key Signature computation fails!\n");

                    return false;

                }

         

                try

                {

                script.results_1N = script.unsupervisedFilter  .findMatch1N  ( script.imageSignature ,  a1File,  b1File);

                }

                catch (Exception e)

                {

                    appendText ( "UnsupervisedFilter 1:N Matching fails:\n"

        + e.ToString () + "\n");

                    return false;

                }

                if ( script.results_1N == null )

                    {

                        appendText ( "UnsupervisedFilter 1:N Matching fails!\n" );

                        return false;

                    }

         

                if ( script.results_1N.getStatus () )

                    {

                    setText ( script.results_1N.toString () + "\n");

                    appendText ("" + script.results_1N.getNumberOfMatches () +" matches!\n");

                    }

                    else

                    {

                        appendText ( "No Match!\n");

                        return false;

                    }

                }

The following code simply makes sure the key image exists:

        if ( ! System.IO .File .Exists (key) )

                    {

                        appendText ( "Please enter a valid Key!\n");

                        return false;

                    }

The next section of code computes the key signature:

          b = this.signature_Key_Signature (key);

The next section code makes a 1:N Match:

        try

                {

                script.results_1N = script.unsupervisedFilter  .findMatch1N  ( script.imageSignature ,  a1File,  b1File);

                }

                catch (Exception e)

                {

                    appendText ( "UnsupervisedFilter 1:N Matching fails:\n" + e.ToString () + "\n");

                    return false;

                }

The final section of code prints the 1:N Matching results:

        if ( script.results_1N.getStatus () )

                    {

                    setText ( script.results_1N.toString () + "\n");

                    appendText ("" + script.results_1N.getNumberOfMatches () +" matches!\n");

                    }

                    else

                    {

                        appendText ( "No Match!\n");

                        return false;

                    }

 

[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