title: How to subtract two images in python?
body: <p>Here is the code I am using, I don't understand how to resolve this error.</p>
  <pre><code>import cv2
  import imutils
  image = cv2.imread(r&quot;D:\mydata\o1\1\original_1_1.png&quot;)
  image1 = cv2.imread(r&quot;D:\mydata\o1\1\original_1_6.png&quot;)
  image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
  image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
  image = imutils.resize(image, width=min(400, len(image[0])))
  image1 = imutils.resize(image1, width=min(400, len(image1[0])))
  result = cv2.absdiff(image1, image)
  cv2.imshow(result)
  </code></pre>
  <blockquote>
  <pre><code>Traceback (most recent call last)
  
      &lt;ipython-input-10-c242f9498457&gt; in &lt;module&gt;
            7 image = imutils.resize(image, width=min(400, len(image[0])))
            8 image1 = imutils.resize(image1, width=min(400, len(image1[0])))
      ----&gt; 9 result = cv2.absdiff(image1, image)
           10 cv2.imshow(result)
  
  error: OpenCV(3.4.2)
  C:\projects\opencv-python\opencv\modules\core\src\arithm.cpp:659:
  error: (-209:Sizes of input arguments do not match)
  
  The operation is neither 'array op array' (where arrays have the same
  size and the same number of channels), nor 'array op scalar', nor
  'scalar op array' in function 'cv::arithm_op'
  </code></pre>
  </blockquote>