RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 407 forks source link

FrameProcessor - Byte Array to Bitmap #51

Closed bsobe closed 7 years ago

bsobe commented 7 years ago

I try to convert frame.image(Byte Array) to Bitmap with this code BitmapFactory.decodeByteArray(frame.image, 0, frame.image.length);

But, bitmap always return null. How can I convert frame.image to bitmap?

Logcat message: --- SkImageDecoder::Factory returned null

dmitry-zaitsev commented 7 years ago

Frame images are in NV21 format and BitmapFactory is not able to decode them and returns null.

There are various solutions available. Here is one of them: https://stackoverflow.com/a/32793861/926907

Out of curiousity, what are you going to do with those images? Maybe I can provide some advice.

bsobe commented 7 years ago

I am developing real time OCR application with Tesseract (tess-two). Also I need to crop preview (to improve success rate of OCR) with Rect like Barcode libs (barcode libs show full screen preview but only scan specified area).

Can you give a suggestion?

@dmitry-zaitsev