Extract repeating structure from an image
You want to detect two things: lines/curves and circles. There are well-known algorithms to do both, so let's find them separately. I will present a solution in Mathematica. You can translate to your language.


The first step is to eliminate the background. We do this by finding the background: 
img = Import["http://i.stack.imgur.com/Olczj.jpg"]
bimg = ColorConvert[img, "Grayscale"]
Blur[Closing[bimg, 20], 15]





Then dividing by it:


  evenImg = Image[ImageData@bimg/ImageData@Blur[Closing[bimg, 20], 10]]





Detect the edges:



  binImg = EdgeDetect[evenImg, 1, .1]




Now we just need to fill in the strokes:


  smImg = ImageResize[Dilation[binImg, 2], {500}]





We are finally ready for some detection. Let's start with the lines/curves:



  Show[smImg, 
   Graphics[{Yellow, Thick, Line /@ ImageLines[smImg, 0.25]}]]





What about the circles? Let's start by looking at all the connected components:



  morph = MorphologicalComponents@smImg; Colorize@morph




The circles are there, all right. We just need to filter out the objects that are not circular. We can do this by looking at the circularity, elongation, eccentricity, or Euler characteristic. Circles are easy to distinguish from other shapes by these properties.

noncircles = #[[1]] &amp; /@ ComponentMeasurements[morph, "Elongation", # &gt; 0.3 &amp;]
circles = morph /. x_ :&gt; 0 /; MemberQ[noncircles, x] // 
  Colorize // RemoveBackground