PlateRecognizerFactory.java 761 Bytes
package com.ectrip.checkincar.plate;

import android.content.Context;

import com.ectrip.checkincar.core.prefs.AppPrefs;

/** 按设置创建识别引擎:0 模拟 / 1 在线(百度云 REST)/ 2 离线(百度 SDK) */
public final class PlateRecognizerFactory {

    private PlateRecognizerFactory() {
    }

    public static PlateRecognizer create(Context context) {
        switch (AppPrefs.getEngine()) {
            case AppPrefs.ENGINE_ONLINE:
                return new OnlinePlateRecognizer();
            case AppPrefs.ENGINE_OFFLINE:
                return new BaiduPlateRecognizer(context.getApplicationContext());
            case AppPrefs.ENGINE_MOCK:
            default:
                return new MockPlateRecognizer();
        }
    }
}