Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
aedddd81
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
aedddd81
编写于
2月 27, 2022
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug in qkht
上级
ddee6c6d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
14 deletion
+7
-14
deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java
...ain/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java
+6
-13
deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/Predictor.java
...c/main/java/com/baidu/paddle/lite/demo/ocr/Predictor.java
+1
-1
未找到文件。
deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java
浏览文件 @
aedddd81
...
...
@@ -280,20 +280,13 @@ public class MainActivity extends AppCompatActivity {
tvStatus
.
setText
(
"STATUS: run model failed"
);
}
public
void
onImageChanged
(
Bitmap
image
)
{
// Rerun model if users pick test image from gallery or camera
if
(
image
!=
null
&&
predictor
.
isLoaded
())
{
predictor
.
setInputImage
(
image
);
runModel
();
}
}
public
void
set_img
()
{
// Load test image from path and run model
try
{
assetManager
=
getAssets
();
InputStream
in
=
assetManager
.
open
(
imagePath
);
Bitmap
bmp
=
BitmapFactory
.
decodeStream
(
in
);
cur_predict_image
=
bmp
;
ivInputImage
.
setImageBitmap
(
bmp
);
}
catch
(
IOException
e
)
{
Toast
.
makeText
(
MainActivity
.
this
,
"Load image failed!"
,
Toast
.
LENGTH_SHORT
).
show
();
...
...
@@ -420,7 +413,7 @@ public class MainActivity extends AppCompatActivity {
Cursor
cursor
=
managedQuery
(
uri
,
proj
,
null
,
null
,
null
);
cursor
.
moveToFirst
();
if
(
image
!=
null
)
{
// onImageChanged(image)
;
cur_predict_image
=
image
;
ivInputImage
.
setImageBitmap
(
image
);
}
}
catch
(
IOException
e
)
{
...
...
@@ -441,7 +434,7 @@ public class MainActivity extends AppCompatActivity {
Bitmap
image
=
BitmapFactory
.
decodeFile
(
currentPhotoPath
);
image
=
Utils
.
rotateBitmap
(
image
,
orientation
);
if
(
image
!=
null
)
{
// onImageChanged(image)
;
cur_predict_image
=
image
;
ivInputImage
.
setImageBitmap
(
image
);
}
}
else
{
...
...
@@ -464,14 +457,14 @@ public class MainActivity extends AppCompatActivity {
}
public
void
btn_run_model_click
(
View
view
)
{
cur_predict_
image
=
((
BitmapDrawable
)
ivInputImage
.
getDrawable
()).
getBitmap
();
if
(
cur_predict_
image
==
null
)
{
Bitmap
image
=
((
BitmapDrawable
)
ivInputImage
.
getDrawable
()).
getBitmap
();
if
(
image
==
null
)
{
tvStatus
.
setText
(
"STATUS: image is not exists"
);
}
else
if
(!
predictor
.
isLoaded
())
{
tvStatus
.
setText
(
"STATUS: model is not loaded"
);
}
else
{
tvStatus
.
setText
(
"STATUS: run model ...... "
);
predictor
.
setInputImage
(
cur_predict_
image
);
predictor
.
setInputImage
(
image
);
runModel
();
}
}
...
...
deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/Predictor.java
浏览文件 @
aedddd81
...
...
@@ -230,7 +230,7 @@ public class Predictor {
OcrResultModel
result
=
results
.
get
(
i
);
StringBuilder
sb
=
new
StringBuilder
(
""
);
if
(
result
.
getPoints
().
size
()>
0
){
sb
.
append
(
"
;
Det: "
);
sb
.
append
(
"Det: "
);
for
(
Point
p
:
result
.
getPoints
())
{
sb
.
append
(
"("
).
append
(
p
.
x
).
append
(
","
).
append
(
p
.
y
).
append
(
") "
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录