val mBitmap: Bitmap = BitmapFactory.decodeFile(compressedFile.path)
val pixels = IntArray(mBitmap.width * mBitmap.height)
mBitmap.getPixels(pixels, 0, mBitmap.width, 0, 0, mBitmap.width,mBitmap.height)
val rawResult: Result
try {
rawResult =QRCodeReader().decode(BinaryBitmap(HybridBinarizer(RGBLuminanceSource(mBitmap.width, mBitmap.height, pixels))))
mBitmap.recycle()
Observable.just(rawResult.text!!)
} catch (e: Exception) {
mBitmap.recycle()
Observable.error<String>(e)
}
I use zxing to decode pickture picked from android gallery, if the image is download from chrome, it decoded successfully, but if the image is taken from android camera, it thrown NotFoundException. I don`t known the reason.