當前位置: 首頁>>代碼示例>>Java>>正文


Java ExprRecognizer.recognize方法代碼示例

本文整理匯總了Java中com.cyzapps.mathrecog.ExprRecognizer.recognize方法的典型用法代碼示例。如果您正苦於以下問題:Java ExprRecognizer.recognize方法的具體用法?Java ExprRecognizer.recognize怎麽用?Java ExprRecognizer.recognize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.cyzapps.mathrecog.ExprRecognizer的用法示例。


在下文中一共展示了ExprRecognizer.recognize方法的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.recognize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。