java - Color changes when turning Blob from SQLite database to a bitmap and then a mat -


so have image put in blob in sqlite database enter image description here

what next read out blob database (so turn blob bitmap). turn bitmap mat (cause need use feature descriptor) end following mat:

enter image description here

as can see, colors wrong. code:

    bitmapfactory.options bmpfactoryoptions = new bitmapfactory.options();                         bmpfactoryoptions.inpreferredconfig = bitmap.config.argb_8888;                         bmpfactoryoptions.inscaled = false;                         bmpfactoryoptions.outheight = 240;                         bmpfactoryoptions.outwidth = 320;                         // decodes blob bitmap                         byte[] blob = contact.getmp();                         bytearrayinputstream inputstream = new bytearrayinputstream(blob);                         bitmap bitmap = bitmapfactory.decodestream(inputstream);                         bitmap scalen = bitmap.createscaledbitmap(bitmap, 320, 240, false); mat imagemat = new mat();                         utils.bitmaptomat(scalen, imagemat); 

i need output image same input, doing wrong?

update:

when read bitmap image with

    try {                         fileoutputstream out = new fileoutputstream("mnt/sdcard/test.png");                         bitmap.compress(bitmap.compressformat.png, 90, out);                  } catch (exception e) {                         e.printstacktrace();                  } 

it gives image right colors,so color changing has converting bitmap mat.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -