当前位置: 首页>>代码示例>>Java>>正文


Java ExprRecognizer类代码示例

本文整理汇总了Java中com.cyzapps.mathrecog.ExprRecognizer的典型用法代码示例。如果您正苦于以下问题:Java ExprRecognizer类的具体用法?Java ExprRecognizer怎么用?Java ExprRecognizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExprRecognizer类属于com.cyzapps.mathrecog包,在下文中一共展示了ExprRecognizer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recognize

import com.cyzapps.mathrecog.ExprRecognizer; //导入依赖的package包/类
public String recognize() throws ExprRecognizeException, InterruptedException	{
	byte[][] biMatrix = mpaintImgView.getBiMatrix();
       if (biMatrix != null && biMatrix.length > 0 && biMatrix[0].length > 0)  {
           //ImageChop imgChop = rectifySelect(biMatrix);	// do not rectify because it leads to a lot of noise points.
           ImageChop imgChop = new ImageChop();
           imgChop.setImageChop(biMatrix, 0, 0, biMatrix.length, biMatrix[0].length, ImageChop.TYPE_UNKNOWN);
           //----- now start recognization.
           imgChop = imgChop.convert2MinContainer();
   		Log.e(TAG, "Now start to recognize image:");
           long startTime = System.nanoTime();
           StructExprRecog ser = ExprRecognizer.recognize(imgChop, null, -1, 0, 0);
           ser = ser.restruct();
           ser.rectifyMisRecogChars1stRnd(CameraPreview.msCLM);
           ser.rectifyMisRecogChars2ndRnd();
           ser.rectifyMisRecogWords(CameraPreview.msMWM);
           SerMFPTransFlags smtFlags = new SerMFPTransFlags();
           smtFlags.mbConvertAssign2Eq = true;
           String strOutput = SerMFPTranslator.cvtSer2MFPExpr(ser, null, new CurPos(0), CameraPreview.msMWM, smtFlags);
          long endTime = System.nanoTime();
           Log.e(TAG, String.format("recognizing takes %s", toString(endTime - startTime)));
           return strOutput;
       }
       return "";
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:25,代码来源:ActivityFingerPaint.java

示例2: recognize

import com.cyzapps.mathrecog.ExprRecognizer; //导入依赖的package包/类
public String recognize(byte[][] biMatrix) throws ExprRecognizeException, InterruptedException	{
       if (biMatrix != null && biMatrix.length > 0 && biMatrix[0].length > 0)  {
           //ImageChop imgChop = rectifySelect(biMatrix);	// do not rectify because it leads to a lot of noise points.
           ImageChop imgChop = new ImageChop();
           imgChop.setImageChop(biMatrix, 0, 0, biMatrix.length, biMatrix[0].length, ImageChop.TYPE_UNKNOWN);
           //----- now start recognization.
           imgChop = imgChop.convert2MinContainer();
   		Log.e(TAG, "Now start to recognize image:");
           long startTime = System.nanoTime();
           StructExprRecog ser = ExprRecognizer.recognize(imgChop, null, -1, 0, 0);
           ser = ExprFilter.filterRawSER(ser, null);
           if (ser == null) {
           	return "";
           }
           ser = ser.restruct();
           ser = ExprFilter.filterRestructedSER(ser, null, null);
           if (ser == null) {
           	return "";
           }
           ser.rectifyMisRecogChars1stRnd(msCLM);
           ser.rectifyMisRecogChars2ndRnd();
           ser.rectifyMisRecogWords(msMWM);
           SerMFPTransFlags smtFlags = new SerMFPTransFlags();
           smtFlags.mbConvertAssign2Eq = true;
           String strOutput = SerMFPTranslator.cvtSer2MFPExpr(ser, null, new CurPos(0), msMWM, smtFlags);
           long endTime = System.nanoTime();
           Log.e(TAG, String.format("recognizing takes %s", toString(endTime - startTime)));
           return strOutput;
       }
       return "";
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:32,代码来源:CameraPreview.java

示例3: recognizeMathExpr

import com.cyzapps.mathrecog.ExprRecognizer; //导入依赖的package包/类
public static void recognizeMathExpr(String strImageFile, CharLearningMgr clm, MisrecogWordMgr mwm, boolean bFilter) throws InterruptedException   {
    BufferedImage image = ImageMgr.readImg(strImageFile);
    byte[][] biMatrix = ImageMgr.convertImg2BiMatrix(image);
    ImageChop imgChop = new ImageChop();
    imgChop.setImageChop(biMatrix, 0, 0, biMatrix.length, biMatrix[0].length, ImageChop.TYPE_UNKNOWN);
    imgChop = imgChop.convert2MinContainer();
    System.out.println("Now reading image file " + strImageFile + " :");
    long startTime = System.nanoTime();
    String strOutput = "\\Exception";
    try {
        StructExprRecog ser = ExprRecognizer.recognize(imgChop, null, -1, 0, 0);
        StructExprRecog serOld = ser;
        //System.out.println("Before raw filter, image " + strImageFile + " includes expression : " + ser.toString());
        if (bFilter) {
            ser = ExprFilter.filterRawSER(ser, null);
            serOld = ser;
        }
        if (ser != null) {
            //System.out.println("Before restruct, image " + strImageFile + " includes expression : " + ser.toString());
            ser = ser.restruct();
            serOld = ser;
            if (bFilter) {
                ser = ExprFilter.filterRestructedSER(ser, null, null);
                serOld = ser;
            }
            if (ser != null) {
                ser.rectifyMisRecogChars1stRnd(clm);
                ser.rectifyMisRecogChars2ndRnd();
                ser.rectifyMisRecogWords(mwm);
                SerMFPTransFlags smtFlags = new SerMFPTransFlags();
                smtFlags.mbConvertAssign2Eq = true;
                strOutput = SerMFPTranslator.cvtSer2MFPExpr(ser, null, new CurPos(0), mwm, smtFlags);
            } else {
                strOutput = "NO VALID EXPRESSION FOUND.";
            }
        } else {
            strOutput = "NO VALID EXPRESSION FOUND.";
        }
    } catch(ExprRecognizeException e)   {
        if (e.getMessage().compareTo(ExprRecognizer.TOO_DEEP_CALL_STACK) == 0)    {
            strOutput = "Expression is too complicated to recognize.";
        }
    }
    long endTime = System.nanoTime();
    System.out.println("After restruct, image " + strImageFile + " includes expression :\n" + strOutput);
    //System.out.println(String.format("recognize %s takes %s", strImageFile, toString(endTime - startTime)));
}
 
开发者ID:woshiwpa,项目名称:JMathImgProc,代码行数:48,代码来源:JImageProcessor.java


注:本文中的com.cyzapps.mathrecog.ExprRecognizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。