I'm using OpenCV read image to Mat with Java, then put image pixels to JNI, however, the JNI required to use Bitmap format
How can I convert Mat to Bitmap with Java? It should run on Ubuntu.
Have you already tried?
Bitmap bmp = null;
Mat tmp = new Mat (height, width, CvType.CV_8U, new Scalar(4));
try {
//Imgproc.cvtColor(seedsImage, tmp, Imgproc.COLOR_RGB2BGRA);
Imgproc.cvtColor(seedsImage, tmp, Imgproc.COLOR_GRAY2RGBA, 4);
bmp = Bitmap.createBitmap(tmp.cols(), tmp.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(tmp, bmp);
}
catch (CvException e){Log.d("Exception",e.getMessage());}
from Here