title: Android Studio Opencv Canny detection
body: <p>I want to add canny detection for an image when I click to button. I cant take any exception but emilator stops working without starting.         </p>
  
  <pre><code>buton2.setOnClickListener(new View.OnClickListener() {
  
      public void onClick(View view) {
  
          ImageView i = (ImageView) findViewById(R.id.imageView);
  
          Bitmap bmp =BitmapFactory.decodeResource(getResources(),R.drawable.ab);
          Mat srcMat = new Mat ( bmp.getHeight(), bmp.getWidth(), CvType.CV_8UC3);
  
          Bitmap myBitmap32 = bmp.copy(Bitmap.Config.ARGB_8888, true);
  
          Utils.bitmapToMat(myBitmap32, srcMat);
  
          Mat gray = new Mat(srcMat.size(), CvType.CV_8UC1);
          Imgproc.cvtColor(srcMat, gray, Imgproc.COLOR_RGB2GRAY);
          Mat edge = new Mat();
          Mat dst = new Mat();
          Imgproc.Canny(gray, edge, 80, 90);
          Imgproc.cvtColor(edge, dst, Imgproc.COLOR_GRAY2RGBA,4);
          Bitmap resultBitmap = Bitmap.createBitmap(dst.cols(), dst.rows(),Bitmap.Config.ARGB_8888);
          Utils.matToBitmap(dst, resultBitmap);
  
          i.setImageBitmap(resultBitmap);
      }
  });
  </code></pre>