Atalasoft MobileImage API Reference
Classes | Public Member Functions | List of all members
com.kofax.kmc.ken.engines.ImageClassifier Class Reference

This class is used to classify images based on given configuration and model. More...

Classes

enum  ImageClassificationStatus
 

Public Member Functions

 ImageClassifier ()
 Public constructor allows instantiation from other classes. More...
 
void doCleanup ()
 Log app stats dismissal time and clean up local objects. More...
 
ImageClassificationStatus getStatus ()
 
void addImageClassificationCompletedEventListener (ImageClassificationCompletedListener listener)
 Adds the specified listener to receive classification completed events. More...
 
void removeImageClassificationCompletedEventListener (ImageClassificationCompletedListener listener)
 Removes the specified listener from receiving classification completed events. More...
 
void setMaxNumberOfResults (int maxNumberOfResults)
 Set the maximum number of classification results to return for an image. More...
 
int getMaxNumberOfResults ()
 Returns the specified maximum number of classification results to return for an image. More...
 
int loadConfigurationFile (String configFileName)
 Loads a file that contains configuration values for the classifier. More...
 
int loadModel (String modelFileName)
 Loads a model file that contains the knowledge source for classification. More...
 
int classifyImage (Image image)
 Use this method to start the image classification process. More...
 

Detailed Description

This class is used to classify images based on given configuration and model.

An example of classification would be taking captured images of drivers licenses and classifying them by the issuing state.

The configuration files for use with this API are contained in the SDK in the "Configuration Files" folder of the SDK deliverable.
Use the configuration file driverslicense_config.xml with the loadConfigurationFile(String) method to setup the classifier to classify United States drivers licenses.
Use the model file driverslicense_model.xml with the loadModel(String) method to setup the model for the classifier.
Once these files are loaded, you can use the classifyImage(Image) method to determine what type of drivers license is contained in the Image object.

Example:

private void classificationExample() {
String pathToClassifyConfig = getPathToClassifyConfig();
String pathToClassifyModel = getPathToClassifyModel();
Image imgToClassify = getImageToClassify();
ImageClassifier imgClass = new ImageClassifier();
imgClass.addImageClassificationCompletedEventListener(this);
imgClass.loadConfigurationFile(pathToClassifyConfig);
imgClass.loadModel(pathToClassifyModel);
imgClass.setMaxNumberOfResults(5);
imgClass.classifyImage(imgToClassify);
}
@Override
public void onImageClassified(ImageClassificationCompleteEvent event) {
Image imageClassified = event.getImage();
List<ImageClassificationResult> results = imageClassified.getImageClassifyResults();
}
See also
ImageClassificationCompletedListener
ImageClassificationResult

Constructor & Destructor Documentation

com.kofax.kmc.ken.engines.ImageClassifier.ImageClassifier ( )
inline

Public constructor allows instantiation from other classes.

Prior to SDK 2.2, ImageClassifier was a singleton object, only instantiated once from the getInstance() method. It is now a regular instance object although multiple instances are still not allowed to be used concurrently.

Member Function Documentation

void com.kofax.kmc.ken.engines.ImageClassifier.addImageClassificationCompletedEventListener ( ImageClassificationCompletedListener  listener)
inline

Adds the specified listener to receive classification completed events.

Parameters
listenerthe listener
See also
ImageClassificationCompletedListener
int com.kofax.kmc.ken.engines.ImageClassifier.classifyImage ( Image  image)
inline

Use this method to start the image classification process.

Call the loadModel(String) and loadConfigurationFile(String) methods before calling classifyImage(). Results are returned to objects added using the addImageClassificationCompletedEventListener() method.

Parameters
imageImage to use for classification. A reference will be returned with populated results.
void com.kofax.kmc.ken.engines.ImageClassifier.doCleanup ( )
inline

Log app stats dismissal time and clean up local objects.

Call this method right before setting your ImageClassifier object to null. After calling this method, your ImageClassifier object is no longer usable.

int com.kofax.kmc.ken.engines.ImageClassifier.getMaxNumberOfResults ( )
inline

Returns the specified maximum number of classification results to return for an image.

Returns
the maximum number of classification results
ImageClassificationStatus com.kofax.kmc.ken.engines.ImageClassifier.getStatus ( )
inline

Returns the current state of the image classification object. It could be available, or it could be processing an image classification.

Returns
the status of this classifier
int com.kofax.kmc.ken.engines.ImageClassifier.loadConfigurationFile ( String  configFileName)
inline

Loads a file that contains configuration values for the classifier.

Parameters
configFileNamePath to the configuration file.
int com.kofax.kmc.ken.engines.ImageClassifier.loadModel ( String  modelFileName)
inline

Loads a model file that contains the knowledge source for classification.

Parameters
modelFileNameThe path to the model file.
void com.kofax.kmc.ken.engines.ImageClassifier.removeImageClassificationCompletedEventListener ( ImageClassificationCompletedListener  listener)
inline

Removes the specified listener from receiving classification completed events.

Parameters
listenerthe listener to remove
See also
ImageClassificationCompletedListener
void com.kofax.kmc.ken.engines.ImageClassifier.setMaxNumberOfResults ( int  maxNumberOfResults)
inline

Set the maximum number of classification results to return for an image.

Minimum = 1, Maximum: 64

Parameters
maxNumberOfResultsthe maximum number of classification results to return

The documentation for this class was generated from the following file:
Untitled Document © 2016 Atalasoft, Inc., 116 Pleasant St, Suite 321, Easthampton, MA 01027, U.S.A. All rights reserved. Use is subject to license terms.