i am working on a software where i want to do some image processing and detect the circle from the image and there is two circles that i want to detect first one is in the object (rough diamond) and the second one is i am drawing on the image or video box.
here are some images of which type of the image it will be
Image1
Image2
Image3
Image4
here in above images one red circle is i am drawing using some parameters and the black circle that are on the object is the circle i want to detect for compare or to match with circle that i have drawn on the video box.
now after the detection is complete i want to compare or match the circles that i am drawing and the circle that i get from the image processing from the image.
so i am trying image processing from 2 days still did not get the result i want.
thus i have to think about Machine Learning Or AI
if i can provide data set of matched or not matched circles then can i use the AI or Machine learning for my project?
if yes then how can i use and how much time is needed for this?
What I have tried:
i have tried EmguCV Library and done some image processing but this is not accurate still i am stuck on just detection of the black circle on the object(rough diamond)
here i have done some image processing using emgucv but did not getting the result i want
results i got using this code is :
image1
image2
note: also works for some of the images not for all.
Image<Gray, byte> grayImage = originalImage.Convert<Gray, byte>();
pictureBox1.Image = grayImage.ToBitmap();
CvInvoke.GaussianBlur(grayImage, grayImage, new Size(5, 5), 0);
pictureBox2.Image = grayImage.ToBitmap();
double thresholdValue = 70;
Image<Gray, byte> binaryImage = grayImage.ThresholdBinary(new Gray(thresholdValue), new Gray(255));
pictureBox3.Image = binaryImage.ToBitmap();
VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();
Mat hierarchy = new Mat();
CvInvoke.FindContours(binaryImage, contours, hierarchy, RetrType.List, ChainApproxMethod.ChainApproxSimple);
for (int i = 0; i < contours.Size; i++)
{
using (VectorOfPoint contour = contours[i])
{
double area = CvInvoke.ContourArea(contour);
double perimeter = CvInvoke.ArcLength(contour, true);
double circularity = (4 * Math.PI * area) / (perimeter * perimeter);
if (circularity > 0.8 && contour.Size > 150)
{
CircleF circle = CvInvoke.MinEnclosingCircle(contour);
originalImage.Draw(circle, new Bgr(Color.Red), 2);
}
}
}
pictureBox.Image = originalImage.ToBitmap();