Utils.bitmapToMat
converts an Android Bitmap to an OpenCV Mat. It requires a bitmap of type ARGB_8888
or RGB_565
.
import org.opencv.android.Utils;
Mat mat = new Mat();
Bitmap bmp32 = bmp.copy(Bitmap.Config.ARGB_8888, true);
Utils.bitmapToMat(bmp32, mat);