title: Error Converting a CtvColor on Android and OpenCV on Eclipse
body: <p>i'm developing to Android using openCV in Eclipse. I'm trying do template matching Frame a Frame. I can't convert the template and doing the match template on it. I'm using that function:</p>
  
  <pre><code>public void initialize(){
      if (src.empty())
          return;
      if(template == null){
          Mat templ = Highgui.imread(getFileAbsPath("1.png",
                  Highgui.CV_LOAD_IMAGE_UNCHANGED);
          template = new Mat(templ.size(), CvType.CV_32F);
          Imgproc.cvtColor(templ, (Mat) template, Imgproc.COLOR_BGR2RGBA);
      }
  }
  
   private String getFileAbsPath(String fileName) {
     File f = new File(cacheDir, fileName);
     return f.getAbsolutePath();
  }
  </code></pre>
  
  <p>I get a error on:</p>
  
  <pre><code>Imgproc.cvtColor(templ, (Mat) template, Imgproc.COLOR_BGR2RGBA);
  </code></pre>
  
  <p>My image is that (it's number 1):
  <a href="https://drive.google.com/file/d/0B5tH_Qo3-GvhaV9QSTUteXFiQmM/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B5tH_Qo3-GvhaV9QSTUteXFiQmM/view?usp=sharing</a></p>
  
  <p>Next, I've my method:</p>
  
  <pre><code>@Override
  public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
  
     src = inputFrame.rgba();
     initialize();
     int match_method = Imgproc.TM_SQDIFF;
  
     // Create the result matrix
     int result_cols = src.cols() - ((Mat) template).cols() + 1;
     int result_rows = src.rows() - ((Mat) template).rows() + 1;
     Mat result = new Mat(result_rows, result_cols, CvType.CV_32F);
  
    // Do the Matching and Normalize
    Imgproc.matchTemplate(src, (Mat) template, result, match_method);
    Core.normalize(result, result, 0, 1, Core.NORM_MINMAX, -1, new Mat());
  
    MinMaxLocResult mmr = Core.minMaxLoc(result);
  
    Point matchLoc;
    if (match_method == Imgproc.TM_SQDIFF || match_method == Imgproc.TM_SQDIFF_NORMED) {
      matchLoc = mmr.minLoc;
  } else {
      matchLoc = mmr.maxLoc;
  }
  
  Rect roi = new Rect((int) matchLoc.x, (int) matchLoc.y, ((Mat) template).cols(), ((Mat) template).rows());
  Core.rectangle(src, new Point(roi.x, roi.y), new Point(roi.width - 2, roi.height - 2), new Scalar(255, 0, 0, 255), 2);
  
  return src;
  </code></pre>
  
  <p>}</p>
  
  <p>I get a error on that line:</p>
  
  <pre><code>Imgproc.matchTemplate(src, (Mat) template, result, match_method);
  </code></pre>
  
  <p>I can't do the match, don't know why ... Cans someone help me ?</p>