title: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() while dealing with images
body: <p>I want to check the gray pixels in image with this code</p>
  
  <pre><code>import numpy as np
  import cv2
  from matplotlib import pyplot as plt
  img = cv2.imread(r'C:\Users\KING K\Downloads\sampletel.jpg',1)
  
  r,c,b=img.shape
  for i in range(r):
      for j in range(c):
          if img[i,j] &lt; 200:
              print(i,j)
              print("this pixel is black")
  </code></pre>
  
  <p>I am getting error like this</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-8-d51057033506&gt; in &lt;module&gt;()
        7 for i in range(r):
        8     for j in range(c):
  ----&gt; 9         if img[i,j] &lt; 200:
       10             print(i,j)
       11             print("this pixel is black")
  
  ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  
  <p>Can you suggest any solution</p>