Search code examples
algorithmperformancegraphicsimage-processingedge-detection

What is the fastest way of edge detection?


I am thinking of implement a image processing based solution for industrial problem.

The image is consists of a Red rectangle. Inside that I will see a matrix of circles. The requirement is to count the number of circles under following constraints. (Real application : Count the number of bottles in a bottle casing. Any missing bottles???)

  1. The time taken for the operation should be very low.
  2. I need to detect the red rectangle as well. My objective is to count the items in package and there are no mechanism (sensors) to trigger the camera. So camera will need to capture the photos continuously but the program should have a way to discard the unnecessary images.
  3. Processing should be realtime.
  4. There may be a "noise" in image capturing. You may see ovals instead of circles.

My questions are as follows,

  1. What is the best edge detection algorithm that matches with the given scenario?
  2. Are there any other mechanisms that I can use other than the edge detection?
  3. Is there a big impact between the language I use and the performance of the system?

Solution

  • AHH - YOU HAVE NOW TOLD US THE BOTTLES ARE IN FIXED LOCATIONS!

    IT IS AN INCREDIBLY EASIER PROBLEM.

    All you have to do is look at each of the 12 spots and see if there is a black area there or not. Nothing could be easier.

    You do not have to do any edge or shape detection AT ALL.

    It's that easy.

    You then pointed out that the box might be rotatated, things could be jiggled. That the box might be rotated a little (or even a lot, 0 to 360 each time) is very easily dealt with. The fact that the bottles are in "slots" (even if jiggled) massively changes the nature of the problem. You're main problem (which is easy) is waiting until each new red square (crate) is centered under the camera. I just realised you meant "matrix" literally and specifically in the sentence in your original questions. That changes everything totally, compared to finding a disordered jumble of circles. Finding whether or not a blob is "on" at one of 12 points, is a wildly different problem to "identifying circles in an image". Perhaps you could post an image to wrap up the question.


    Finally I believe Kenny below has identified the best solution: blob analysis.


    "Count the number of bottles in a bottle casing"...

    Do the individual bottles sit in "slots"? ie, there are 4x3 = 12 holes, one for each bottle.

    In other words, you "only" have to determine if there is, or is not, a bottle in each of the 12 holes.

    Is that correct?

    If so, your problem is incredibly easier than the more general problem of a pile of bottles "anywhere".

    Quite simply, where do we see the bottles from? The top, sides, bottom, or? Do we always see the tops/bottoms, or are they mixed (ie, packed top-to-tail). These issues make huge, huge differences.