Trouble converting mat to bitmap?
I am using OpenCV to detect the similarities between two images. Unfortunately, my line of code that converts my Mat back to a bitmap is causing my app to crash. Does anyone have any ideas what would be causing this? Here is my code:
Bitmap centerBit = BitmapFactory.decodeResource(getResources(), R.drawable.center);
Mat center = new Mat();
Utils.bitmapToMat(centerBit,center);
Mat resultCenter = new Mat();
Imgproc.matchTemplate(center,center,resultCenter,Imgproc.TM_SQDIFF_NORMED);
Bitmap bm = Bitmap.createBitmap(resultCenter.cols(), resultCenter.rows(),Bitmap.Config.ARGB_ 8888);
Utils.matToBitmap(resultCenter, bm); // THIS LINE CREATING ERROR
ImageView iv = (ImageView) findViewById(R.id.imageView);
iv.setImageBitmap(bm);