OcrHelper.java :  » Net » Neuroph-2.4 » org » neuroph » contrib » ocr » Java Open Source

Java Open Source » Net » Neuroph 2.4 
Neuroph 2.4 » org » neuroph » contrib » ocr » OcrHelper.java
package org.neuroph.contrib.ocr;

import java.awt.Dimension;
import java.util.List;
import java.util.Vector;
import org.neuroph.contrib.imgrec.ColorMode;
import org.neuroph.contrib.imgrec.ImageRecognitionHelper;
import org.neuroph.core.NeuralNetwork;
import org.neuroph.util.TransferFunctionType;


/**
 * Provides methods to create Neural Network and Training set for OCR.
 * @author zoran
 */
public class OcrHelper extends ImageRecognitionHelper {

    /**
     * Creates neural network for OCR, which contains OCR plugin. OCR plugin provides interface for character recognition.
     * @param label neural network label
     * @param samplingResolution character size in pixels (all characters will be scaled to this dimensions during recognition)
     * @param colorMode color mode used fr recognition
     * @param characterLabels character labels for output neurons
     * @param layersNeuronsCount number of neurons ih hidden layers
     * @param transferFunctionType neurons transfer function type
     * @return returns NeuralNetwork with the OCR plugin
     */
    public static NeuralNetwork createNewNeuralNetwork(String label, Dimension samplingResolution, ColorMode colorMode, List<String> characterLabels,  Vector<Integer> layersNeuronsCount, TransferFunctionType transferFunctionType) {
        NeuralNetwork neuralNetwork = ImageRecognitionHelper.createNewNeuralNetwork(label, samplingResolution, colorMode, characterLabels, layersNeuronsCount, transferFunctionType);
        neuralNetwork.addPlugin(new OcrPlugin(samplingResolution, colorMode));

        return neuralNetwork;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.