title: How to find circle inside Rectangle in AForge
body: <p>I am trying to detect Circle inside Rectangle in <code>AForge</code>. I have successfully determined <code>Rectangles</code> but unable to find <code>circles</code> inside <code>Rectangle</code>. How to find shape inside another shape in <code>AForge</code>.</p>
  
  <pre><code>string strPath = Server.MapPath("~/Recipt001.png");
  Bitmap myBitmap = new Bitmap(strPath);
  
  //Some filters Grayscale, invert, threshold
  
  //Blod Filtering                      
  
  
  BlobCounter blobCounter = new BlobCounter();
  blobCounter.ProcessImage(temp);
  blobCounter.ObjectsOrder = ObjectsOrder.YX;
  blobCounter.FilterBlobs = true;
  
  Blob[] blobs = blobCounter.GetObjectsInformation();
  Graphics g = Graphics.FromImage(myBitmap);
  Pen redPen = new Pen(Color.Red, 2);
  SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
  
  // dictionary of color to highlight different shapes
  Dictionary&lt;PolygonSubType, Color&gt; colors = new Dictionary&lt;PolygonSubType, Color&gt;();
  
  colors.Add(PolygonSubType.Unknown, Color.White);
  colors.Add(PolygonSubType.Trapezoid, Color.Orange);
  colors.Add(PolygonSubType.Parallelogram, Color.Red);
  colors.Add(PolygonSubType.Rectangle, Color.Green);
  colors.Add(PolygonSubType.Square, Color.Blue);
  colors.Add(PolygonSubType.Rhombus, Color.Gray);
  
  colors.Add(PolygonSubType.EquilateralTriangle, Color.Pink);
  colors.Add(PolygonSubType.IsoscelesTriangle, Color.Purple);
  colors.Add(PolygonSubType.RectangledTriangle, Color.SkyBlue);
  colors.Add(PolygonSubType.RectangledIsoscelesTriangle, Color.SeaGreen);
  
  for (int i = 0, n = blobs.Length; i &lt; n; i++)
  {
      List&lt;IntPoint&gt; corners;
      List&lt;IntPoint&gt; edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
      Point center;
      double radius;
  
      if (shapeChecker.IsQuadrilateral(edgePoints, out corners))
      {
          if (shapeChecker.CheckPolygonSubType(corners) == PolygonSubType.Rectangle)
          {
              g.DrawPolygon(redPen, ToPointsArray(corners));
          }
      }
  }
  
  redPen.Dispose();
  g.Dispose();
  </code></pre>