21. API21.1 ImageFinder Internal Structures
21.2 Software Structure
21.3 Standard API
21.4 Example: Unsupervised Learning
This chapter introduces the standard Application Programming Interface (API) of the ImageFinder for software developers.
The neural network level library is called PolyApplet and the image recognition level library is called TransApplet. You must order the ImageFinder libraries separately.
Very often a customized ImageFinder will be ordered before ordering the ImageFinder library as a proof-of-concept test, based on a specific set of images.
21.1 ImageFinder Internal Structures
ImageFinder adopts a layered approach to image recognition. An image recognition application is roughly divided into:
Level 5: User Interface;
Level 4: Data Management;
Level 3: Image-Matching Layer;
Level 2: Scanner, Camera, and their
drivers;
Level 1: PC with Windows.The reason for the above approach is the ImageFinder library will be integrated into a database application. The Stand-alone software is roughly divided into 3 layers:
Level 3: User Interface;
Level 2: Image-Matching Layer;
Level 1: PC with Windows.For the ImageFinder, the Image-Matching Layer is divided into:
Image Preprocessing
Normalization
Feature Recognition
Pixel Recognition
Sub-Pixel Recognition
Each of the sub-layers is further divided into filters:
Image Preprocessing
Edge Filters;Normalization
Threshold Filters; and
Clean Up Filters.Reduction Filter.Feature RecognitionBioFilter;Pixel Level Recognition
Neural Filter.NeuralNet Filter or ABM Filter.Multi-Layered Pixel RecognitionBioFilter 2;
NeuralFilter 2;
ABM Filter 2.
…
The API is basically organized accordingly. Each section will have three sub-sections:· Filters
· Parameters
· CommandsThe Filter section sets and gets the filter; the Parameter section sets and gets the parameters, and the command section executes the commands.
The software structure is:
Main Class (TransApplet6x):
Image Preprocessing Class
Normalization Class
Feature Recognition Class
Pixel Recognition Class
Sub-Pixel Recognition Class
Each of these classes is further divided into several classes; for example,Image Preprocessing Class
Edge Filter class
Threshold Filter class
Clean Up Filter class
Again, each of these classes is further divided into several classes; for example,Edge Filter Class
Sobel 1 class
Sobel 2 class
…The software was originally developed under Microsoft Visual Studio 6.0, then later converted into J#.Net. Therefore, developers must have both .Net Framework and J# Redistributable package installed. The following specification still has the Java flavor:
Public class TransApplet6x
{//Input
void setKeySegment (String s);
String getKeySegment ();
boolean getKeySegmentStatus();void setSerachDir (String s);
String getSerachDir ();
boolean getSerachDirStatus();void setFileInput (String s);
String getFileInput ();
boolean getFileInputStatus();
//Image Preprocessing
//1. Filters Section
void setEdgeFilters(int);
int getEdgeFilters();void setThresholdFilters (int);
int getThresholdFilters ();void setCleanUpFilter (int);
int getCleanUpFilter ();//2. Parameter Section
//color: R1, R2, R3, G1, G2, G3, B1, B2, B3
void setR1(int);
int getR1();
…//3. Command Section: NA
//Normalization
//1. Filter section
void setReductionFilter (int);
int getReductionFilter ();//2. Parameter Section
void setSegmentCut(int);
int getSegmentCut(i);void setSizeCut(int);
int getSizeCut();void setBorderCut(int);
int getBorderCut();void setLookAtX(int);
int getLookAtX();void setLookAtY(int);
int getLookAtY();void setLookAtXLength(int);
int getLookAtXLength();void setLookAtYLength(int);
int getLookAtYLength();//3. Command Section: NA
//Feature Recognition
//BioFilter
//1. Filter Sectionvoid set BioFilter (int);
int getBioFilter();//2. Parameter section
void setBioFilterPercent(int);
int getBioFilterPercent();void setBioFilterMode(int);
int getBioFilterMode();void setBioFilterFinal(int);
int getBioFilterFinal();void setBioFilterCutOff(int);
int getBioFilterCutOff();//3. Command Section
boolean scanImageDir();
boolean scanImageFile();boolean bioFilterTrain();
Boolean bioFilterNNMatchUntrained();
Boolean bioFilter1NMatchUntrained();Boolean bioFilterNNMatch();
Boolean bioFilter1NMatch();Boolean bioFilterCheck();
String getBioFilterResults(int);
boolean scanImageDir(int);
boolean scanImageFile(int);//Neural Filter
//1. Filter section
void setNeuralFilter(int);
int getNeuralFilter();//2. Parameter section
void setNeuralFilterPercent (int);
get getNeuralFilterPercent ();void setNeuralFilterMode (int);
get getNeuralFilterMode ();void setNeuralFilterSize (int);
get getNeuralFilterSize ();void setNeuralFilterFinal (int);
int getNeuralFilterFinal ();void setNeuralFilterCutOff (int);
int getNeuralFilterCutOff ();//3. Command Section
boolean neuralFilterTrain();Boolean neuralFilterNNMatch();
Boolean neuralFilter1NMatch();
Boolean neuralFilter1N1Match();Boolean neuralFilterCheck();
String getNeuralFilterResults(int);
Boolean neuralFilterNMMatch(String a1, String a2, String b2);
//Pixel Level Recognition
//ABM Filter or NeuralNet Filter
//1. Filter Section
void setNeuralNet(int);
int getNeuralNet();//2. Parameter Section
void setSegmentX (int);
int getSegmentX ();void setSegmentY(int);
int setSegmentY();void setSegmentXlength(int);
int getSegmentXlength();void setSegmentYLength(int);
int getSegmentYLength();void setSymmetry(int);
int getSymmetry();void setRotationType(int);
int getRotationType();void setTranslationType(int);
int getTranslationType();void setScalingType(int);
int getScalingType();void setSensitivity(int);
int getSensitivity();void setBlurring(int);
int setBlurring();void setInternalWeightCut(int);
get setInternalWeightCut();void setExternalWeightCut(int);
int setExternalWeightCut();void setSegmentSize(int);
int getSegmentSize();void setImageType(int);
int getImageType();void setFileDisplayType(int);
int setFileDisplayType();void setAutoSegment(int);
int getAutoSegment();void setNeuralNetMode(int);
int setNeuralNetMode();//3. Command Section
boolean NeuralNetTrain();
boolean NeuralNetRetrain();Boolean NeuralNet1NSearch();
Boolean NeuralNetNNSearch();
Boolean NeuralNetSort();Boolean NeuralNet1NSearchLong();
Boolean NeuralNetSortLong();
Void getLongSearchDir(String s);
String getLongSearchDir();Boolean NeuralNet1NSearchFile();
Boolean NeuralNetNNSearchFile();
Boolean NeuralNetSortFile();String getNeuralNetResults(int);
… …}
After the execution, the results go to the files. You can process the output by reading and processing the output files from the TransApplet.
21.4 Example: Unsupervised Learning
Assume we want to match an image, C:\abc\input.jpg, with the images in C:\efg:
TransApplet60 x = new TransApplet60 ();
Boolean unsupervisedLearning_1_to_N ()
{
x.setKeySegment (“c:\abc\input.jpg”);
if ( ! getKeySegmentStatus() )
return false;x.setSearchDir (“c:\efg”);
if ( ! getSearchDirStatus() )
return false;return x.bioFilter1NMatchUntrained();
}
The results will be in b1.txt.
Return