title: Count total number of white pixels in an image
body: <p>I am trying to count total number of white pixels in the following image:</p>
  <p><img src="https://i.stack.imgur.com/AL3Vj.png" alt="Image " /></p>
  <p>But with my code, I get this error</p>
  <blockquote>
  <p>src is not a numpy array, neither a scalar.</p>
  </blockquote>
  <p>This is my code:</p>
  <pre><code>img=cv2.imread(filename,1)
  TP= width * height
  white= TP - cv2.countNonZero(img[1])
  print &quot;Dimensions:&quot;, img.size, &quot;Total pixels:&quot;, TP, &quot;White&quot;, white
  </code></pre>