title: ValueError in Python, Number of Indices in Array not Matching
body: <p>I'm supposed to write a method that converts an RGB image to Grayscale by using the &quot;average method&quot; where I take the average of the 3 colors (NOT the weighted method or luminosity method). I then must display the original RGB image and grayscale image next to each other (concatenated). The language I'm writing in is Python. This is what my code looks like currently.</p>
  <pre><code>import numpy as np
  import cv2
  
  def average_method(img):
      grayValue = (img[:,:,2] + img[:,:,1] + img[:,:,0])/3
      gray_img = grayValue.astype(np.uint8)
      return gray_img
  
  def main():
      img1 = cv2.imread('html/images/sunflowers.jpg')
      img1 = cv2.resize(img1, (0, 0), None, .25, .25)
      img2 = average_method(img1)
      numpy_concat = np.concatenate((img1, img2), 1)
      cv2.imshow('Numpy Concat', numpy_concat)
      cv2.waitKey(0)
      cv2.destroyAllWindows
  
  if __name__ ==&quot;__main__&quot;:
      main()
  </code></pre>
  <p>When I try to run this, it shows me this error:</p>
  <pre><code>    Traceback (most recent call last):
    File &quot;test.py&quot;, line 23, in &lt;module&gt;
      main()
    File &quot;test.py&quot;, line 16, in main
      numpy_concat = np.concatenate((img1, img2), 1)
    File &quot;&lt;__array_function__ internals&gt;&quot;, line 5, in concatenate
  ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 3 dimension(s) and the array at index 1 has 2 dimension(s)
  </code></pre>
  <p>Can someone please help me figure this out so that I can successfully have RGB and grayscale side by side by using the &quot;average method&quot;? Not sure if I'm setting up the average method correctly and it causes this issue, or if it's from how I try to concatenate the pictures. Thanks.</p>