title: OpenCV remove the edge spots?
body: <p>I try to use the following code to remove spots, spots on the edge of the upper right corner, has been unable to remove it, what should I do ??</p>
  
  <p>CvContourScanner scanner = NULL;
      scanner = cvStartFindContours(img_src,storage,sizeof(CvContour),CV_RETR_CCOMP,CV_CHAIN_APPROX_NONE,cvPoint(0,0));</p>
  
  <pre><code>CvRect rect;
  while (contour=cvFindNextContour(scanner))
  {
      tmparea = fabs(cvContourArea(contour));
      rect = cvBoundingRect(contour,0);   
      if (tmparea &lt; minarea/*||tmparea&gt;4900*/)
      {
  
          pp=(uchar*)(img_Clone-&gt;imageData + img_Clone-&gt;widthStep*(rect.y+rect.height/2)+rect.x+rect.width/2);
          if (pp[0]==0)
          {
              for(int y = rect.y;y&lt;rect.y+rect.height;y++)
              {
                  for(int x =rect.x;x&lt;rect.x+rect.width;x++)
                  {
                      pp=(uchar*)(img_Clone-&gt;imageData + img_Clone-&gt;widthStep*y+x);
  
                      if (pp[0]==0)
                      {
                          pp[0]=255;
                      }
                  }
              }
          }
  
      }
  }
  </code></pre>