title: OpenCV Image Denoising gives: Error: -215:Assertation failed
body: <p>Trying to denoise a really simple image, using the code below. When printing out the array of data I get the following structure, which is expected as the image is greyscale:</p>
  
  <pre><code>[[ 62  62  63 ...  29  16   6]
   [ 75  90 103 ...  21  16  12]
   [ 77 100 118 ...  29  29  30]
   ...
   [ 84  68  56 ...  47  50  53]
   [101  94  89 ...  40  44  48]
  </code></pre>
  
  <p>Here is the code and the associated error, at this point I'm a little stuck. Any suggestions?</p>
  
  <pre><code>import cv2
  from matplotlib import pyplot as plt
  
  img = cv2.imread(path,0)
  dst = cv2.fastNlMeansDenoising(img,None,10,10,7,21)
  
  plt.subplot(211),plt.imshow(dst)
  plt.subplot(212),plt.imshow(img)
  plt.show()
  
  ____________________________________________________________________
  runfile(___, wdir='G:/James Alexander/Python Programs')
  Traceback (most recent call last):
  
    File "&lt;ipython-input-127-ce832752c183&gt;", line 1, in &lt;module&gt;
      runfile('G:/James Alexander/Python Programs/Noiseremoval.py', wdir=___)
  
    File "___", line 704, in runfile
      execfile(filename, namespace)
  
    File "___", line 108, in execfile
      exec(compile(f.read(), filename, 'exec'), namespace)
  
    File "___", line 13, in &lt;module&gt;
      dst = cv2.fastNlMeansDenoising(img,None,10,10,7,21)
  
  error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\photo\src\denoising.cpp:120: error: (-215:Assertion failed) hn == 1 || hn == cn in function 'cv::fastNlMeansDenoising'
  </code></pre>