What is the fastest way to detect edges?

I am thinking of implementing an image processing solution for an industrial problem.

Image consists of a red rectangle. Inside I will see a matrix of circles. The requirement is to calculate the number of laps under the following restrictions. (Real application: count the number of bottles in the bottle case. Any missing bottles ???)

  • The time spent on the operation should be very low.
  • I need to also find a red rectangle. My goal is to count the items in the package and there is no mechanism (sensors) to start the camera. Therefore, the camera will need to capture photos, but the program should have a way to throw out unnecessary images.
  • Processing should be done in real time.
  • There may be “noise” in the image capture. Instead of circles, you can see ovals.

My questions are as follows:

  • What is the best edge detection algorithm that matches the specified scenario?
  • Are there any other mechanisms that I can use other than edge detection?
  • Is there a big impact on the language I use and the performance of the system?
+4
source share
6 answers

AHH - YOU NOW TOLD THAT BOTTLES IN FIXED PLACES!

THIS IS AN INCREDIBLE 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 simpler.

You do not need to perform detection of borders or shapes in ALL.

It is easy.

Then you pointed out that the box can be rotated, everything can be funny. The fact that the box can be rotated a little (or even a lot, from 0 to 360 each time) is very easy to handle. The fact that the bottles are in the “slots” (even if they are mixed) significantly changes the nature of the problem. The main problem (which is easy) is waiting for each new red square (box) to be centered under the camera. I just realized that you mean the "matrix" literally and specifically in the sentence in your original questions. This completely changes everything, compared to finding a messy mess of circles. Finding whether a blob is "on" in one of 12 items is a completely different problem for "identifying circles in the image." Perhaps you can send an image to close the question.


Finally, I believe that Kenny defined the best solution below : blob analysis.


"Count the number of bottles in the bottle case" ...

Are individual bottles separated in “slots”? those. 4x3 = 12 holes, one for each bottle.

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

Is it correct?

If so, your problem is incredibly simpler than the more general bottle heap problem anywhere.

Pretty simple, where do we see the bottles? Top, side, bottom, or? Do we always see tops / bottoms, or do they mix (i.e. are packed from top to bottom). These problems create huge differences.

+8
source

Surf / Sift = overkill in this case, of course, you do not need.

If you need real-time speed (about 20 frames per second + on an 800x600 image), I recommend using Cuda to implement edge detection using the sobel standard filter, then binarize + close the image so that the edges of the circles are not divided into segments.

The hardest part will fit the circles. This assumes that you have already reached the level at which you took the edges, and make sure that they are associated with image closure (morphology). At this point, I would do the following:

  • run an analysis of blob / connected components to segment circles that are not touching. If circles can touch the next step, it will be harder
  • for each connected / blob component, a circle or rectangle is suitable with RANSAC , which can be executed in real time (unlike Hough Transform, which I find it very difficult to run in real time.)

Step 2 will be much more difficult if you cannot segment the related components that form the circles separately, so you need to add an additional thought on how to guarantee this condition.

Good luck.

Edit

After thinking a little more about it, I feel that RANSAC is ideal for the case where the components associated with the circle touch each other. RANSAC should hypothetically fit the circle only to part of the connected component (due to its ability to work well in the case of most ejection points). This means that you can add additional verification to make sure that the installed circle covers the entire connected component, and if it does not restart RANSAC on the part of the connected component that was left. Rinse and repeat as many times as necessary.

I also understand that I'm saying a circle, but you can just as easily pick up an ellipse instead of circles using RANSAC.

In addition, I would like to comment that when I say that CUDA is a good choice, I mean that CUDA is a good choice for implementing the sobel + binirization + close filter. The connected components and RANSAC are probably best left on the CPU, but you can try to push them on CUDA, although I do not know what advantage the GPU gives for these two processors.

+3
source
  • For circles, try the Hough transform.
  • other mechanisms: dunno
  • Compiled languages ​​may be faster.
+2
source
  • Sum of colors + convex body for border detection. Do you need basically 4 corners of the rectangle, not the sides?
  • There is no movement, there is no second camera, a small choice - a lot of mathematical methods versus a small input (color histograms, color distribution matrix). Dunno.
  • Java == high memory consumption, Lisp == high brain consumption, C ++ == memory / processor / speed / brain usage is optimal.
+1
source

SIFT must have a very good answer to round objects - it is patented. GLOH is a similar algorithm, but I don't know if any implementations are available.

Actually, having done some more research, SURF is an improved version of SIFT with a fairly large number of implementations available, check the links on the wikipedia page.

+1
source

If the contrast is good, blob analysis is the algorithm to work with.

+1
source

All Articles