java - Android opencv load grayscale png with 16bit depth -
i new opencv4android , trying load grayscale png image 16bit depth.
i tried:
mat mat2dimg = utils.loadresource(getbasecontext(), r.drawable.image, highgui.cv_load_image_grayscale);
but png read 8bit values in [0,255]. tried cv_load_image_anydepth flag same. tried create alpha channel or loading image raw did not manage have work.
i tried copy image on device , read imread follow hoping imread load 16bit channel:
java.lang.string filename = "/storage/emulated/0/image.png"; mat mat2dimg = highgui.imread(filename, 0);
when check file.exists()
exist. mat
returned not null empty.
can suggest way load image properly?
i managed work by:
1) added in manifest:
<uses-permission android:name="android.permission.read_external_storage"/ >
this removes empty image issue.
2) load image cv_load_image_anydepth
flag
rgbloadedimage = highgui.imread(filename, highgui.cv_load_image_anydepth);
values in proper 16 bit range.
Comments
Post a Comment