title: Detection of coins (and fit ellipses) on an image
body: <p>I am currently working on a project where I am trying to detect a few coins lying on a flat surface (i.e. a desk). The coins do not overlap and are not hidden by other objects. But there might be other objects visible and the lighting conditions may not be perfect... Basically, consider yourself filming your desk which has some coins on it.</p>
  
  <p>So each point should be visible as an Ellipse. Since I don't know the position of the camera the shape of the ellipses may vary, from a circle (view from top) to flat ellipses depending on the angle the coins are filmed from.</p>
  
  <p>My problem is that I am not sure how to extract the coins and finally fit ellipses over them (which I am looking for to do further calculations).</p>
  
  <p>For now, I have just made the first attempt by setting a threshold value in OpenCV, using findContours() to get the contour lines and fitting an ellipse. Unfortunately, the contour lines only rarely give me the shape of the coins (reflections, bad lighting, ...) and this way is also not preferred since I don't want the user to set any threshold.</p>
  
  <p>Another idea was to use a template matching method of an ellipse on that image, but since I don't know the angle of the camera nor the size of the ellipses I don't think this would work well...</p>
  
  <p>So I wanted to ask if anybody could tell me a method that would work in my case.</p>
  
  <p><strong>Is there a fast way to extract the three coins from the image? The calculations should be made in realtime on mobile devices and the method should not be too sensitive for different or changing lights or the color of the background.</strong></p>
  
  <p>Would be great if anybody could give me any tips on which method could work for me.</p>