title: How to fix The operation is neither 'array op array' when adding watermark to image
body: <p>I'm new to OpenCV and Python. I'm trying to add watermark to an image and have been following this Youtube tutorial:
  <a href="https://www.youtube.com/watch?v=zbJ3EY4s9r8" rel="nofollow noreferrer">https://www.youtube.com/watch?v=zbJ3EY4s9r8</a></p>
  <p><strong>This is the error that I get:</strong></p>
  <blockquote>
  <p>Traceback (most recent call last):   File
  &quot;C:\Users\User\Desktop\watermark\watermark3.py&quot;, line 27, in 
  result = cv2.addWeighted(roi,1,logo,0.3,0) cv2.error: OpenCV(4.5.5)
  D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650:
  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'</p>
  </blockquote>
  <p>I think I have followed the same instruction from the video:</p>
  <pre><code>import cv2
  import numpy as np
  import glob
  import os
  
  logo = cv2.imread(&quot;images/testlogo2.png&quot;)
  h_logo, w_logo, _=logo.shape
  print(h_logo, w_logo)
  
  images_path = glob.glob(&quot;C:/Users/User/Desktop/testimage/*.*&quot;)
  #deciding the position of the logo
  for img_path in images_path:
      img = cv2.imread(img_path)
      h_img, w_img, _=img.shape
      print(h_img, w_img)
      center_x = int(w_img/2)
      center_y = int(h_img/2)
      top_y=center_y+int(h_logo/2)
      left_x=center_x+int(w_logo/2)
      bottom_y=h_logo+top_y
      right_x=w_logo+left_x
  
      #roi
      roi = img[top_y:bottom_y, left_x:right_x]
  
      # Add the Logo to the Roi
      result = cv2.addWeighted(roi,1,logo,0.3,0)
  
      # Replace the ROI on the image
      img[top_y: bottom_y, left_x: right_x] = result
  
      # Get filename and save the image
      filename = os.path.basename(img_path)
      cv2.imwrite(&quot;C:/Users/User/Desktop/testimage/new/logo_&quot;+filename,img)
  
  print(&quot;Watermark added to al the images&quot;)
  </code></pre>