-1

I am new to OpenCV and I'm trying to count and locate broken or cracked biscuits (those which are not perfect circles as they should be) in the image.

What kind of strategy should I follow?

Any suggestion can help to open my mind. Regards.

ergosys
  • 47,835
  • 5
  • 49
  • 70

1 Answers1

2

Your question is very abstract (it would be better if you provide some picture), but I can try to answer it.

First of all you have to detect all busquits on your image. To do this you have to find bisquit color (maybe HSV color space would be better for your aim) on your picture and convert input image to single channel image (or matrix), each element of this matrix can be:

  • 1 (or 255) if this pixel belongs to bisquit
  • 0 if not.

[OpenCV function inRange may help you to do such conversion.]

When bisquits are detected you can:

  1. Use HoughCircles to detect normal bisquits (if normal bisquit is round).
  2. Find contours of each bisquit (take a look at findContours) and compare each contour with normal bisquit (if it's not round) using cross-corellation or maybe other methods (Euclidean distance etc).

Also look at HoughCircle tutorial to detect just circles if your image doesn't contain other circles (except bisquits).

Community
  • 1
  • 1
ArtemStorozhuk
  • 8,715
  • 4
  • 35
  • 53