title: Alternative for deprecated CreateImage function in cv2 API
body: <p>I am updating the packages used in a project of mine and I would like to use the updated cv2 API and I've come across this problem where the cv.CreateImage function is no longer being used.</p>
  
  <p>The following is the code that is giving me problems:</p>
  
  <pre class="lang-py prettyprint-override"><code>grey_image = cv.cvtColor(i, cv.COLOR_RGB2GRAY)
  df_dx = cv.CreateImage(cv.GetSize(i), cv.IPL_DEPTH_16S, 1)
  cv.Sobel(grey_image, df_dx, 1, 1)
  </code></pre>
  
  <p>The variable 'i' is an RGB image of size 640*480.</p>
  
  <p>I've tried to make use of numpy to replicate what this method should be doing as follows:</p>
  
  <pre class="lang-py prettyprint-override"><code>df_dx = np.zeros(i.shape[0], i.shape[1], i.shape[2]), np.int16)
  </code></pre>
  
  <p>but this then provides the following errors</p>
  
  <pre class="lang-py prettyprint-override"><code>&lt;class 'tuple'&gt;: (&lt;class 'TypeError'&gt;, TypeError('only size-1 arrays can be converted to Python scalars'), None)
  </code></pre>
  
  <p>This forced me to believe that when i'm creating the numpy array, it is throwing this error, and i do not know how I can fix it. Thanks in advance</p>