Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BYLAppRobot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuyang
BYLAppRobot
Commits
d4ac7aba
Commit
d4ac7aba
authored
Jan 10, 2019
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APK图片抓取识别及轮播流地址抓取, 优化识别结果提取
#BYLSERVER-1438
parent
43097d09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
build.gradle
app/build.gradle
+2
-2
Task.kt
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
+1
-1
OcrManager.kt
app/src/main/java/com/duolebo/blyrobot/tools/OcrManager.kt
+2
-2
AppUtil.kt
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
+1
-1
No files found.
app/build.gradle
View file @
d4ac7aba
...
@@ -12,8 +12,8 @@ android {
...
@@ -12,8 +12,8 @@ android {
applicationId
"com.duolebo.bylrobot"
applicationId
"com.duolebo.bylrobot"
minSdkVersion
15
minSdkVersion
15
targetSdkVersion
22
targetSdkVersion
22
versionCode
2
0
versionCode
2
3
versionName
"1.6.
2
"
versionName
"1.6.
3
"
}
}
signingConfigs
{
signingConfigs
{
...
...
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
View file @
d4ac7aba
...
@@ -441,7 +441,7 @@ class Task : Thread, IAppBaseCallback {
...
@@ -441,7 +441,7 @@ class Task : Thread, IAppBaseCallback {
private
fun
imageOcrToNumber
()
{
private
fun
imageOcrToNumber
()
{
val
channelArr
=
this
.
reportJson
.
optJSONArray
(
"channels"
)
val
channelArr
=
this
.
reportJson
.
optJSONArray
(
"channels"
)
for
(
i
in
0
..
channelArr
.
length
())
{
for
(
i
in
0
until
channelArr
.
length
())
{
try
{
try
{
val
channelJson
=
channelArr
.
optJSONObject
(
i
)
val
channelJson
=
channelArr
.
optJSONObject
(
i
)
var
imagePath
=
this
.
taskPath
+
"/"
+
channelJson
.
optString
(
"channelImage"
)
var
imagePath
=
this
.
taskPath
+
"/"
+
channelJson
.
optString
(
"channelImage"
)
...
...
app/src/main/java/com/duolebo/blyrobot/tools/OcrManager.kt
View file @
d4ac7aba
...
@@ -70,7 +70,7 @@ class OcrManager {
...
@@ -70,7 +70,7 @@ class OcrManager {
val
num
=
result
.
getInt
(
"words_result_num"
)
val
num
=
result
.
getInt
(
"words_result_num"
)
if
(
wordsResult
!=
null
&&
num
>
0
)
{
if
(
wordsResult
!=
null
&&
num
>
0
)
{
val
len
=
wordsResult
.
length
()
val
len
=
wordsResult
.
length
()
for
(
i
in
0
..
len
)
{
for
(
i
in
0
until
len
)
{
val
wordsObject
=
wordsResult
.
getJSONObject
(
i
)
val
wordsObject
=
wordsResult
.
getJSONObject
(
i
)
try
{
try
{
val
rawWords
=
wordsObject
.
getString
(
"words"
)
val
rawWords
=
wordsObject
.
getString
(
"words"
)
...
@@ -79,7 +79,7 @@ class OcrManager {
...
@@ -79,7 +79,7 @@ class OcrManager {
val
p
=
Pattern
.
compile
(
regEx
)
val
p
=
Pattern
.
compile
(
regEx
)
val
m
=
p
.
matcher
(
rawWords
)
val
m
=
p
.
matcher
(
rawWords
)
val
newWords
=
m
.
replaceAll
(
""
).
trim
()
val
newWords
=
m
.
replaceAll
(
""
).
trim
()
if
(
newWords
.
length
==
1
1
)
{
if
(
newWords
.
length
==
1
0
)
{
words
=
newWords
words
=
newWords
break
break
}
}
...
...
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
View file @
d4ac7aba
...
@@ -100,7 +100,7 @@ object AppUtil {
...
@@ -100,7 +100,7 @@ object AppUtil {
val
bitmap
=
BitmapFactory
.
decodeFile
(
imagePath
)
val
bitmap
=
BitmapFactory
.
decodeFile
(
imagePath
)
try
{
try
{
val
height
=
bitmap
.
height
val
height
=
bitmap
.
height
val
cropBitmap
=
Bitmap
.
createBitmap
(
bitmap
,
0
,
height
-
100
,
1024
,
100
)
val
cropBitmap
=
Bitmap
.
createBitmap
(
bitmap
,
0
,
height
-
100
,
bitmap
.
width
,
100
)
val
index
=
imagePath
.
lastIndexOf
(
'.'
)
val
index
=
imagePath
.
lastIndexOf
(
'.'
)
val
partName
=
imagePath
.
substring
(
0
,
index
)
val
partName
=
imagePath
.
substring
(
0
,
index
)
val
newPath
=
partName
+
"_ocr.jpg"
val
newPath
=
partName
+
"_ocr.jpg"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment