title: Need only one edge in Canny edge algorithm
body: <p>When i use the canny edge algorithm, it produces the 2 edges opposite the thick colored line as expected, but i want only one edge to be displayed so as to make my line and curve detection algorithm much less complicated, any ideas on how i can make that happen ?</p>
  
  <p><img src="https://i.stack.imgur.com/pCFWS.png" alt="enter image description here"></p>
  
  <p>Here is the code :</p>
  
  <pre><code>bool CannyEdgeDetection(DataStructure&amp; col)
  {
  
  Mat src, src_gray;
  Mat dst, detected_edges, fin;
  int WhiteCount = 0, BCount = 0;
  
  char  szFil1[32] = "ocv.bmp";
  char  szFil2[32] = "dst.bmp";
  src = imread(szFil1);
  dst = imread(szFil1);
  blur( src_gray, detected_edges, Size(3,3) );
  Canny( src, dst, 100, 200, 3 );
  imwrite(szFil2, dst );
  
  IplImage* img = cvLoadImage(szFil2);
  int height    = img-&gt;height;
  int width     = img-&gt;width;
  int step      = img-&gt;widthStep;
  int channels  = img-&gt;nChannels;
  uchar * datau      = (uchar *)img-&gt;imageData;
  
  for(int i=0;i&lt;height;i++){
  for(int j=0;j&lt;width;j++){
  for(int k=0;k&lt;channels;k++){
  datau[i*step+j*channels+k] = 255 - datau[i*step+j*channels+k];   
  if (datau[i*step+j*channels+k]==0){
  WhiteCount++;
  col.pixel_col [i][j] = 2;
  }
  else{BCount++;
  col.pixel_col[i][j] = 0;
  }
  }
  }
  }
  
  cvSaveImage("img.bmp" ,img);
  
  return 0;
  
  }
  </code></pre>
  
  <p>This is not the original image but similar :</p>
  
  <p><img src="https://i.stack.imgur.com/ZQYDA.png" alt="enter image description here"></p>
  
  <p>Which part do i comment out to be able to read black images in white backgrounds ? or any colored image ?</p>
  
  <pre><code>bool done;
  do
  {
    cv::morphologyEx(img, temp, cv::MORPH_OPEN, element);
    cv::bitwise_not(temp, temp);
    cv::bitwise_and(img, temp, temp);
    cv::bitwise_or(skel, temp, skel);
    cv::erode(img, img, element);
  
    double max;
    cv::minMaxLoc(img, 0, &amp;max);
    done = (max == 0);
  } while (!done);
  </code></pre>