title: OpenCV: Draw Lines from Canny
body: <p>I'm a complete novice when it comes to OpenCV, so this is probably a dumb question.</p>
  
  <p>I'm just trying to get something basic up and running- I want to draw the edges detected by the Canny algorithm directly on the image coming in. I currently have this:</p>
  
  <p><img src="https://i.stack.imgur.com/Hu8RW.png" alt="Canny Screenshot"> </p>
  
  <p>I'm displaying the edge data from Canny directly, but now I want to get rid of the black and just show the white, on the image being processed.</p>
  
  <p>I've tried googling things like "using binary image as alpha mask", but after a day of reading tutorials and trying everything I can find, I'm still not sure I know what's going on. OpenCV seems very powerful, so this is probably a pretty easy thing to do, so I'm hoping somebody can point me in the right direction.</p>
  
  <p>Here's the code I'm using, most of which has been copied from the examples: </p>
  
  <pre><code>public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
  
      Mat rgba = inputFrame.rgba();
      org.opencv.core.Size sizeRgba = rgba.size();
  
      Mat rgbaInnerWindow;
  
  
      int rows = (int) sizeRgba.height;
      int cols = (int) sizeRgba.width;
  
      int left = cols / 8;
      int top = rows / 8;
  
      int width = cols * 3 / 4;
      int height = rows * 3 / 4;
  
      //get sub-image
      rgbaInnerWindow = rgba.submat(top, top + height, left, left + width);
  
      //create edgesMat from sub-image
      Imgproc.Canny(rgbaInnerWindow, edgesMat, 100, 100);
  
      //copy the edgesMat back into the sub-image
     Imgproc.cvtColor(edgesMat, rgbaInnerWindow, Imgproc.COLOR_GRAY2BGRA, 4);
  
      rgbaInnerWindow.release();
  
      return rgba;
  }
  </code></pre>
  
  <p>Edit: I've also posted this question on the OpenCV forums <a href="http://answers.opencv.org/question/55272/drawing-lines-from-canny/" rel="nofollow noreferrer">here</a>.</p>