亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

能幫我看看這個空指針異常是怎么回事?求大神指點

能幫我看看這個空指針異常是怎么回事?求大神指點

慕沐林林 2023-04-24 22:18:35
這是logcat報錯信息這是報錯函數的代碼(識別圖片中字符的函數)public String decodeBitmapValue(String path) {BitmapFactory.Options options = new BitmapFactory.Options();options.inSampleSize = 2;Bitmap bitmap = BitmapFactory.decodeFile(IMAGE_PATH, options); Log.i(TAG, "---in ocr() before try--");try {Log.v(TAG, "not in the exception");ExifInterface exif = new ExifInterface(IMAGE_PATH);int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); Log.v(TAG, "Orient: " + exifOrientation); int rotate = 0;switch (exifOrientation) {case ExifInterface.ORIENTATION_ROTATE_90:rotate = 90;break;case ExifInterface.ORIENTATION_ROTATE_180:rotate = 180;break;case ExifInterface.ORIENTATION_ROTATE_270:rotate = 270;break;} Log.i(TAG, "Rotation: " + rotate); } catch (IOException e) {Log.e(TAG, "Rotate or coversion failed: " + e.toString());Log.v(TAG, "in the exception");} Log.i(TAG, "Bitmap創建成功");if (bitmap == null) {return null;}baseApi.init(TESSBASE_PATH, DEFAULT_LANGUAGE);bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, false);baseApi.setImage(bitmap);Log.i(TAG, "Bitmap加載成功");String value = baseApi.getUTF8Text();Log.i("TAG", " the value is ===> " + value);baseApi.clear();baseApi.end();return value;}
查看完整描述

1 回答

?
HUH函數

TA貢獻1836條經驗 獲得超4個贊

你153行有個對象是null的。

查看完整回答
反對 回復 2023-04-27
  • 1 回答
  • 0 關注
  • 216 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號