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

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -