title: Scale image object to match another object's scale
body: <p>I have two sets of images of different size for each set. The first set is images of 400x400 pixels with real picture objects.</p>
  
  <p><a href="https://i.stack.imgur.com/krcJW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/krcJW.png" alt="enter image description here"></a></p>
  
  <p>The second set is 319x319, with image silhouettes of different scale than the real picture objects.</p>
  
  <p><a href="https://i.stack.imgur.com/YAS6b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YAS6b.png" alt="enter image description here"></a></p>
  
  <p>What I want to achieve, is basically to have the silhouettes replaced by the real picture objects (i.e. beaver) of the first set. So the end result will be 319x319 resolution images with real picture objects. Here is an example:</p>
  
  <p><a href="https://i.stack.imgur.com/K6kkN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K6kkN.png" alt="example of the desired result"></a></p>
  
  <p>The first set images cannot simply be resized to 319x319, since the beaver will not match the silhouette. There are about 100 images with different "<strong><em>beaver size</em></strong> to <strong><em>beaver's silhouette size</em></strong>" relationships. Is there a way to automate this procedure?</p>
  
  <p>So far, I've tried @cxw suggestion up to step 2. Here is the code of <a href="http://pastebin.com/VGkniMbE" rel="nofollow noreferrer">EllipseDirectFit</a> I used. And here is my <a href="http://pastebin.com/F7j0N5Dp" rel="nofollow noreferrer">code</a> to plot the images with the ellipse fits. I don't know how to proceed to steps 3-5.. I think from EllipseDirectFit function -> 2*abs(A(1)) should be the ellipsi's major axes. (NOTE: 'a1.bmp' is the real image and 'b1.bmp' is the silhouette).</p>