0

I'm trying to detect a pattern like this in some images

Pattern (ideal)

The actual image looks something like this

PAttern (actual)

It could be scaled and/or rotated. Is there a way to do that efficiently without resorting to neural nets or some learning algorithm? Can some detection be done based on the value gradient for example (dark-bright-dark-bright-dark)?

Mohamed Tarek
  • 385
  • 3
  • 11
  • I think it would help if you could post one or more examples of your *entire* source image here, instead of just the part you are trying to detect. Finding two white bars in the cropped example shown here is obviously a trivial task. – r3mainer Nov 27 '13 at 19:23

2 Answers2

0

input image is MxN (in your example M<N ):

  1. take mean RGB image
  2. mean Y to get 1xN vector
  3. derive
  4. abs
  5. threshold
  6. calculate the distance between peaks.
  7. search for a location where the ratio between the distances is as expected (from what i see in your example ~ 1:7:1)
  8. if a place found, validate the colors in the middle of the distance (from your example should be white-black-white)
Alessandro Jacopson
  • 18,047
  • 15
  • 98
  • 153
Mercury
  • 1,886
  • 5
  • 25
  • 44
  • Thanks. But it seems to me that your algorithm does not take into account that the pattern could be oriented at any angle. Or am I missing something? – Mohamed Tarek Nov 27 '13 at 17:12
  • well, according to the line width, you need to calculate the delta angle, and repeat the process for every angle in resolution of delta angle. – Mercury Nov 27 '13 at 17:36
  • Oh I see what you mean now. It's an interesting approach, but I think I didn't make it clear that this pattern would be part of a larger image. There are other areas in the image that would produce strong and bigger peaks. – Mohamed Tarek Nov 27 '13 at 18:40
0

You might be able to use Gabor Filters at varying orientations, and do standard threshold to identify objects.

If you know the frequency of the pattern you could try using a bandpass filter to isolate objects at that frequency. If it is a very strong frequency, you might be able to identify it in the image's Fourier transform.

Without much other knowledge about what you are looking for in your image, it will be very difficult to identify a specific repeating pattern.

David Nilosek
  • 1,422
  • 9
  • 13