title: OpenCV Processing - Edge detection and Cropping
body: <p>How do i remove the irregular white pixels from the preprocessed image.</p>
  
  <p>i have tried doing erosion and that would make all pixels black.</p>
  
  <p>After Preprocessing:</p>
  
  <p><a href="https://i.stack.imgur.com/iJa6H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iJa6H.png" alt="enter image description here"></a></p>
  
  <p>Requirement:</p>
  
  <p><a href="https://i.stack.imgur.com/Bimrc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bimrc.png" alt="enter image description here"></a></p>
  
  <p>My Code:</p>
  
  <pre><code>Mat  img, edges, erode, blurred, element;
  element = getStructuringElement(cv::MORPH_RECT, cv::Size(7, 7), cv::Point(-1,-1) ); 
  
  img = imread("img1925.jpeg");    //  read the image
  cv::Canny(img, edges, 30, 255, 3);    // detect the edges with threshold limit
  
  //    cv::erode(edges, erode, element);
  
  GaussianBlur(edges, blurred, cv::Size(7, 7), 0);    // blurring
  
  //    Rect ROI = boundingRect(blurred);       // draw rect for ROI
  //    Mat src = thresh(ROI);
  
  namedWindow("image", WINDOW_NORMAL);
  imshow("image", blurred);
  waitKey(0);
  return 0;
  </code></pre>
  
  <p>Looking for suggestions!</p>