Commit d4ac7aba authored by liuyang's avatar liuyang

APK图片抓取识别及轮播流地址抓取, 优化识别结果提取

#BYLSERVER-1438
parent 43097d09
......@@ -12,8 +12,8 @@ android {
applicationId "com.duolebo.bylrobot"
minSdkVersion 15
targetSdkVersion 22
versionCode 20
versionName "1.6.2"
versionCode 23
versionName "1.6.3"
}
signingConfigs {
......
......@@ -441,7 +441,7 @@ class Task : Thread, IAppBaseCallback {
private fun imageOcrToNumber() {
val channelArr = this.reportJson.optJSONArray("channels")
for ( i in 0..channelArr.length()) {
for ( i in 0 until channelArr.length()) {
try {
val channelJson = channelArr.optJSONObject(i)
var imagePath = this.taskPath + "/" + channelJson.optString("channelImage")
......
......@@ -70,7 +70,7 @@ class OcrManager {
val num = result.getInt("words_result_num")
if (wordsResult != null && num > 0) {
val len = wordsResult.length()
for ( i in 0..len) {
for ( i in 0 until len) {
val wordsObject = wordsResult.getJSONObject(i)
try {
val rawWords = wordsObject.getString("words")
......@@ -79,7 +79,7 @@ class OcrManager {
val p = Pattern.compile(regEx)
val m = p.matcher(rawWords)
val newWords = m.replaceAll("").trim()
if (newWords.length == 11) {
if (newWords.length == 10) {
words = newWords
break
}
......
......@@ -100,7 +100,7 @@ object AppUtil {
val bitmap = BitmapFactory.decodeFile(imagePath)
try {
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 partName = imagePath.substring(0, index)
val newPath = partName + "_ocr.jpg"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment