-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lixungeng
committed
Dec 24, 2024
1 parent
de82245
commit 6c5a990
Showing
23 changed files
with
11,138 additions
and
6,362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
cd /d %~dp0 | ||
cd src | ||
..\spt\protoc.exe --cpp_out=lite:. -I ../pb ocr_common.proto ocr_wx3.proto ocr_wx4.proto | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
syntax = "proto3"; | ||
package ocr_common; | ||
|
||
message Point{ | ||
optional float x = 1; | ||
optional float y = 2; | ||
} | ||
|
||
message Box{ | ||
optional Point topleft = 1; | ||
optional Point topright = 2; | ||
optional Point bottomright = 3; | ||
optional Point bottomleft = 4; | ||
} | ||
|
||
message OCRResultChar{ | ||
optional Box char_box = 1; | ||
optional string chars = 2; | ||
} | ||
|
||
message OCRResultLine { | ||
Box line_box = 1; | ||
string text = 2; //UTF8格式的字符串 | ||
float rate = 3; //单行的识别率 | ||
repeated OCRResultChar blocks = 4; | ||
float left = 5; //识别矩形的left\top\right\bottom的坐标 | ||
float top = 6; | ||
float right = 7; | ||
float bottom = 8; | ||
optional bool unknown_0 = 9; //未知 | ||
optional Box box10 = 10; //未知 | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
syntax = "proto3"; | ||
package wx3; | ||
import "ocr_common.proto"; | ||
|
||
message OcrInputBuffer { | ||
// 看起来有两种传递图片的方式。 | ||
// 第一种是只传文件路径 pic_path = "C:/path/to/xxx.png" | ||
// 第二种是用字节流传,猜测需要用到u2,u3,pic_data变量。暂时微信没有用到,可能是为将来保留 | ||
optional string pic_path = 1; | ||
optional uint32 u2 = 2; | ||
optional uint32 u3 = 3; | ||
optional bytes pic_data = 4; | ||
} | ||
|
||
message OcrOutputBuffer { | ||
repeated ocr_common.OCRResultLine lines = 1; //repeated 每行的结果 | ||
optional uint32 img_width = 2; | ||
optional uint32 img_height = 3; | ||
optional string unk4 = 4; | ||
} | ||
|
||
message OcrRespond { | ||
optional int32 type = 1; // type=1像是初始化成功回调。如果是正常OCR请求,回答的type=0 | ||
optional uint64 task_id = 2; | ||
optional int32 err_code = 3; | ||
optional OcrOutputBuffer ocr_result = 4; | ||
} | ||
|
||
message OcrRequest { | ||
int32 type = 1; //为0执行ocr,为1会直接返回init信息. 与OcrRespond.type意义相同 | ||
// 经过反复核查,在腾讯proto文件中,这个task_id确实是64位的。但在,在执行过程中,高32位会被丢弃,且第32位为1会出错。 | ||
// 也就是协议上是有64位的uint64,实际上只能有31位。必须是>0的整形数字,范围是[1,2147483647] | ||
// 由于 task_id = 1会被用于初始化,所以最好取值为 [2, 0x7fffFFFF] | ||
uint64 task_id = 2; | ||
OcrInputBuffer input = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
syntax = "proto3"; | ||
package wx4; | ||
import "ocr_common.proto"; | ||
|
||
message OCRSupportMessage { | ||
optional bool supported = 1; | ||
} | ||
|
||
message ReqType { | ||
optional bool t1 = 1; | ||
optional bool t2 = 2; | ||
optional bool t3 = 3; | ||
} | ||
|
||
message ParseOCRReqMessage { | ||
optional uint64 task_id = 1; | ||
optional string pic_path = 2; | ||
optional uint32 xx3 = 3; | ||
optional uint32 xx4 = 4; | ||
optional bytes pic_data = 5; | ||
optional ReqType rt = 6; | ||
} | ||
|
||
message OCRResultInfo { | ||
repeated ocr_common.OCRResultLine lines = 3; | ||
optional uint32 img_width = 4; | ||
optional uint32 img_height = 5; | ||
optional string cpu_report = 6; | ||
optional uint64 time_used = 7; | ||
} | ||
|
||
message QRResultInfo { | ||
} | ||
message MMFGResultInfo { | ||
} | ||
|
||
message ParseOCRRespMessage { | ||
optional uint64 task_id = 1; | ||
optional int32 err_code = 2; | ||
optional OCRResultInfo res = 3; | ||
optional ReqType rt = 4; | ||
optional bytes qrcode = 5; // ¶þάÂëʶ±ð | ||
optional bytes mmfg = 6; // what is mmfg? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.