Reputation: 11
I'm trying to find a way to determine the centre point between two lines, at different positions, using OpenCV in C#. In Roborealm, I achieved this using the edge_probe technique, as illustrated in the second image. Now, I want to replicate this functionality in C# using OpenCV with the first image. I need multiple centre points so that I can get an average value for the centre, because the lines aren't straight.
As I'm new to OpenCV, I'd appreciate any suggestions or guidance on how to approach this problem. Additionally, since I'm working with a Windows form application, I'm interested in any suggestions related to displaying the edge points and center points, similar to how I did it in Roborealm.
Thank you in advance for any help or insights you can provide!
opencv:
Roborealm:
This is what I've done up to this point to get the first image.
Mat image = CvInvoke.Imread("C:\\Image_2.png");
Mat kernel1 = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Rectangle, new Size(3, 3), new Point(1, 1));
CvInvoke.CvtColor(image, image, Emgu.CV.CvEnum.ColorConversion.Bgr2Gray);
CvInvoke.MedianBlur(image, image, 9);
CvInvoke.Threshold(image, image, 100, 255, Emgu.CV.CvEnum.ThresholdType.Binary);
CvInvoke.MorphologyEx(image, image, Emgu.CV.CvEnum.MorphOp.Close, kernel1, new Point(0, 0), 6, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar());
CvInvoke.Canny(image, image, 50, 200);
pictureBox1.Image = new System.Drawing.Bitmap(image.ToBitmap(), image.Width, image.Height);
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
Upvotes: 1
Views: 65