Procházet zdrojové kódy

图像识别兼容,暂时这样了

zhangyang před 6 roky
rodič
revize
9622e509f5

+ 0 - 2
bin/Win32/Debug/zhipuzi_pay_plugin/skin/shoukuan_wnd.xml

@@ -15,8 +15,6 @@
 				<Edit name="money_edit" float="true" pos="223,0,400,60" font="1" textcolor="0xFF3CB371" bkcolor="0xFFFCFCFC" nativebkcolor="0xFFFCFCFC"/>
 			</HorizontalLayout>
 			
-			<Control height="1" padding="120,5,120,0" bkcolor="0xFF3CB371"></Control>
-			
 			<HorizontalLayout name="shoukuan_money_show_layout" height="50" padding="0,15,0,15" visible="false">
 				<Label text="¥" font="0" textcolor="0xFF3CB371" float="true" pos="200,24,215,50"/>
 				<Label name="shoukuan_money_show_money" font="1" textcolor="0xFF3CB371" float="true" pos="225,12,500,48"/>

binární
bin/Win32/Debug/zhipuzi_pay_plugin/zhipuzi_pay_plugin.exe


binární
bin/Win32/Debug/zhipuzi_pay_plugin/zpzDll.dll


+ 3 - 3
include/leptonica/pix.h

@@ -206,9 +206,9 @@ static const l_int32  L_ALPHA_SHIFT =
  *          YUV colorspace.  Those numbers come from the
  *          International Telecommunications Union, via ITU-R.
  */
-static const l_float32  L_RED_WEIGHT =   0.3;
-static const l_float32  L_GREEN_WEIGHT = 0.5;
-static const l_float32  L_BLUE_WEIGHT =  0.2;
+static const l_float32  L_RED_WEIGHT =   (l_float32)0.3;
+static const l_float32  L_GREEN_WEIGHT = (l_float32)0.5;
+static const l_float32  L_BLUE_WEIGHT =  (l_float32)0.2;
 
 
 /*-------------------------------------------------------------------------*

binární
lib/debug/zpzDll.lib


+ 15 - 7
zhipuzi_pay_plugin/helper/CBitmapHelper.cpp

@@ -285,12 +285,25 @@ bool CBitmapHelper::OcrRect(tesseract::TessBaseAPI& tess, LPRECT lpRect, std::st
 
     const char* utf8_ret = tess.GetUTF8Text();
 
-	char szRes[256] = { 0 };
+	char szRes[10] = { 0 };
 	int j = 0;
 
 	for (int i = 0; i < 255; i++)
 	{
-		if (utf8_ret[i] == '\32')
+		if ((utf8_ret[i] >= '0' && utf8_ret[i] <= '9') || utf8_ret[i] == '.')
+		{
+			szRes[j] = utf8_ret[i];
+			j++;
+
+			if (j == 9)
+			{
+				//已经装了9个了
+				result = szRes;
+
+				break;
+			}
+		}
+		else if (utf8_ret[i] == 32)
 		{
 			//如果是空格,直接忽略
 		}
@@ -301,11 +314,6 @@ bool CBitmapHelper::OcrRect(tesseract::TessBaseAPI& tess, LPRECT lpRect, std::st
 
 			break;
 		}
-		else
-		{
-			szRes[j] = utf8_ret[i];
-			j++;
-		}
 	}
 
     delete[] lpmem;