I'm new C# user and I searched for easy method for drawing an ellipse on the blob, the center is blob center.
Firstly, I used OpenCvSharp.Blob name space but I could not get the center. I used Emu.CV and Aforge.Net also but the center is not achieved.
Which library can get the center in the form of X,Y?
I used this code but also get wrong center:
foreach (Blob blob in blobs)
//Bitmap bitmap = (Bitmap)picConnComp.Image;
//Graphics g = Graphics.FromImage(bitmap);
Pen redPen = new Pen(Color.Red, 2);
if (blob.Rectangle.Width > 50)
// the blob looks interesting, let's extract it
(float)(blob.Image.Width / 2), (float)(blob.Image.Height / 2));
If using AForge.NET framework you can get rectangle directly from blob as follows:
Rectangle rect = blob.Rectangle;
Afterwards you can draw an ellipse of blobs size like this:
... g1.DrawEllipse(redPen, rect); ...