Conversion of a Bitmap to Pixel Array for Microsoft OCR C# -



Conversion of a Bitmap to Pixel Array for Microsoft OCR C# -

i'm working microsoft's ocr library , having problems converting bitmapimage pixel array.

i'm making application windows phone 8, , writeablebitmap.pixelbuffer.toarray() isn't alternative have static function that'll alter normal bitmapimage byte array feed ocr engine.

well, every time feed in application crashes. what's wrong here?

here static class bitmap converter

public static class bytearraychange { public static byte[] converttobytes(this bitmapimage bitmapimage) { byte[] info = null; using (memorystream stream = new memorystream()) { writeablebitmap wbitmap = new writeablebitmap(bitmapimage); wbitmap.savejpeg(stream, wbitmap.pixelwidth, wbitmap.pixelheight, 0, 100); stream.seek(0, seekorigin.begin); info = stream.getbuffer(); } homecoming data; } }

here piece of code in ocr method that's causing application crash.

byte[] pa = bytearraychange.converttobytes(bitmap); //here problem var ocrresult = await ocrengine.recognizeasync((uint)bitmap.pixelheight, (uint)bitmap.pixelwidth, pa);

what doing wrong here? thanks!

you're saving image jpeg, i'm ocr library take rgb/bgra input. why don't utilize pixels property? represents image bgra array, thing need convert byte[] array.

c# arrays windows-phone-8 bitmapimage writeablebitmap

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -