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
what next read out blob database (so turn blob bitmap). turn bitmap mat (cause need use feature descriptor) end following mat:
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
Post a Comment