mIntermediateMat= new Mat();
Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.al);;
Mat rgba= new Mat(bmp.getHeight(), bmp.getWidth(), CvType.CV_8UC1);
Utils.bitmapToMat(bmp, rgba);
Size sizeRgba = rgba.size();
Mat rgbaInnerWindow;
int rows = (int) sizeRgba.height;
int cols = (int) sizeRgba.width;
int left = cols / 19;
int top = rows / 19;
int width = cols * 15/16;
int height = rows * 15/16 ;
rgbaInnerWindow = rgba.submat(top, top + height, left, left + width);
Imgproc.Canny(rgbaInnerWindow, mIntermediateMat, 5, 35);
rgbaInnerWindow.setTo(new Scalar(0, 0, 0, 255), mIntermediateMat);
List<MatOfPoint> contours = mDetector.getContours();
Log.e(TAG, "Contours count: " + contours.size());
Imgproc.drawContours(rgbaInnerWindow, contours, -1, CONTOUR_COLOR);
Bitmap resultBitmap = Bitmap.createBitmap(rgba.cols(),rgba.rows(),Bitmap.Config.ARGB_8888);
Utils.matToBitmap(rgba, resultBitmap);
imageView.setImageBitmap(resultBitmap);
your "rgba" mat has a single channel only ?
Sorry to reply you late, I have just used channels() function to find out the number of channels of 'rgba' mat and it came out out to be 4.