title: How to remove background from an image (subtraction)?
body: <p>I have the following things:</p>
  
  <ul>
  <li>Image before an item is in place (just the background), like this:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/rMoqy.jpg" alt="Background image"></p>
  
  <ul>
  <li>Image with the item, like this:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/oyrKo.jpg" alt="Image with item"></p>
  
  <p>In this case, I want to have an image with just the lens cap. How can I substract these two images? I think OpenCV would fit good for this problem, but I have an issue with substracting these images.</p>
  
  <p>I have found something similarly in this tutorial: <a href="https://docs.opencv.org/3.4/d1/dc5/tutorial_background_subtraction.html" rel="nofollow noreferrer">https://docs.opencv.org/3.4/d1/dc5/tutorial_background_subtraction.html</a> But, they are just talking about using in video and not with before/after image.</p>