title: c# object detection
body: <p><a href="http://img5.imageshack.us/img5/3315/yenidusuk100003.jpg" rel="nofollow">http://img5.imageshack.us/img5/3315/yenidusuk100003.jpg</a></p>
  
  <p><strong>how can i find coordinates of the rectangle in the above picture  using Aforge or any c# library?</strong> </p>
  
  <p><em>i have tried. but it's too slow.</em>  </p>
  
  <p>And these position and size of the rectangles are static.</p>
  
  <p>i found the following code. but can not get any result.</p>
  
  <pre><code>Bitmap image = sourceImage; //(Bitmap)Bitmap.FromFile(path);
  
  
       BlobCounter blobCounter = new BlobCounter();
  
       blobCounter.FilterBlobs = true;
       blobCounter.MinHeight = 1;
       blobCounter.MinWidth = 1;
  
       blobCounter.ProcessImage(image);
       Blob[] blobs = blobCounter.GetObjectsInformation();
  
  
       SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
  
       foreach (var blob in blobs)
       {
           List&lt;IntPoint&gt; edgePoints = blobCounter.GetBlobsEdgePoints(blob);
           List&lt;IntPoint&gt; cornerPoints;
  
  
           if (shapeChecker.IsQuadrilateral(edgePoints, out cornerPoints))
           {
  
               if (shapeChecker.CheckPolygonSubType(cornerPoints) == PolygonSubType.Rectangle)
               {
  
                   List&lt;System.Drawing.Point&gt; Points = new List&lt;System.Drawing.Point&gt;();
                   foreach (var point in cornerPoints)
                   {
                       Points.Add(new System.Drawing.Point(point.X, point.Y));
                   }
  
                   Graphics g = Graphics.FromImage(image);
                   g.DrawPolygon(new Pen(Color.Red, 5.0f), Points.ToArray());
  
                   image.Save("result.png");
               }
           }
       }
  </code></pre>