title: python+openCV : only size-1 arrays can be converted to Python scalars
body: <p>This is my code to rotate the img with cv2.getRotationMatrix2D() function.</p>
  
  <pre><code>smoothed_angle = 0
  
  img = cv2.imread("/home/hp/self driving car/steering_wheel_image.png")
  print(img.shape) #outputs (240, 240, 3)
  rows = img.shape[0]
  print(rows) #outputs 240
  cols = img.shape[1]
  print(cols) #outputs 240
  
  M = cv2.getRotationMatrix2D((cols/2,rows/2),-smoothed_angle,1)
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-37-55419a87d5b5&gt; in &lt;module&gt;()
       34 #and the predicted angle
       35 smoothed_angle += 0.2 * pow(abs((predicted_angle_degree - smoothed_angle)), 2.0 / 3.0) * (predicted_angle_degree - smoothed_angle) / abs(predicted_angle_degree - smoothed_angle)
  ---&gt; 36 M = cv2.getRotationMatrix2D((cols/2,rows/2),-smoothed_angle,1)
       37 dst = cv2.warpAffine(img,M,(cols,rows))
       38 #cv2.imshow("steering wheel", dst)
  
  TypeError: only size-1 arrays can be converted to Python scalars
  </code></pre>
  
  <p>Also, <code>print(type(smoothed_angle))</code> gives the following output:</p>
  
  <pre><code>&lt;class 'numpy.ndarray'&gt;
  </code></pre>