Skip to content

Commit a5d0497

Browse files
committed
feat(paddlejs-examples): add ocr weixin miniprogram example
1 parent 0757d17 commit a5d0497

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

packages/paddlejs-examples/ocrXcx/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,20 @@ wx.canvasGetImageData({
7373
});
7474
```
7575

76-
## 4. 更多
76+
## 4. 常见问题
77+
### 4.1 出现报错 `Invalid context type [webgl2] for Canvas#getContext`
78+
79+
可以不管,不影响正常代码运行和demo功能
80+
81+
### 4.2 微信开发者工具出现黑屏,然后出现超多报错
82+
83+
重启微信开发者工具
84+
85+
### 4.3 模拟和真机调试结果不一致;模拟检测不到文本等
86+
87+
可以以真机为准;
88+
89+
模拟检测不到文本等可以尝试随意改动下代码(增删换行等)再点击编译
90+
91+
## 5. 更多
7792
* [详细文档](https://mp.weixin.qq.com/s/KBjXawSfBreUCsIYbUgF-w)

packages/paddlejs-examples/ocrXcx/pages/index/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function get_rotate_crop_image(img, points) {
283283
const dsize = new CV.Size(img_crop_width, img_crop_height);
284284
// 透视转换
285285
CV.warpPerspective(src, dst, M, dsize, CV.INTER_CUBIC, CV.BORDER_REPLICATE, new CV.Scalar());
286-
console.log('CV', src, dst);
286+
287287
const dst_img_height = dst.rows;
288288
const dst_img_width = dst.cols;
289289
let dst_rot;
@@ -308,7 +308,7 @@ function get_rotate_crop_image(img, points) {
308308
scale = RECHEIGHT / dst_img_height;
309309
CV.resize(dst, dst_resize, dsize_resize, scale, scale, CV.INTER_AREA);
310310
}
311-
console.log('resize', dst_resize);
311+
312312
canvas_det.width = dst_resize.cols;
313313
canvas_det.height = dst_resize.rows;
314314
canvas_det.getContext('2d').clearRect(0, 0, canvas_det.width, canvas_det.height);
@@ -467,7 +467,7 @@ Page({
467467

468468
// 排序,使得最后结果输出尽量按照从上到下的顺序
469469
const boxes = sorted_boxes(points.boxes);
470-
console.log('boxs', boxes);
470+
471471
const text_list = [];
472472

473473
for (let i = 0; i < boxes.length; i++) {

packages/paddlejs-examples/ocrXcx/pages/index/recPostprocess.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ function decode(text_index, text_prob, is_remove_duplicate = false) {
4646
let text = '';
4747
let mean = 0;
4848

49-
console.log('char_list', char_list);
50-
5149
if (char_list.length) {
5250
text = char_list.join('');
5351
let sum = 0;

0 commit comments

Comments
 (0)