title: ValueError:use a.any() or a.all() and AttributeError: 'bool' object has no attribute 'all' python
body: <p>I am trying to run this code:</p>
  
  <pre><code>if (numObj&lt;Max_DetObj):
      i=0
      while (i &gt;= 0).all():
          Moment = cv2.moments(contours[i])
          area = Moment['m00']
          if (area &gt;Min_ObjArea):
              x=Moment['m10']/area
              y=Moment['m01']/area
              found_Obj=True
          else:
              found_Obj=False
          i=hierarchy[i][0]
  </code></pre>
  
  <p>but i get this error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "C:\opencv2.4.8\sources\samples\python2\Work.py", line 120, in &lt;module&gt;
  trackObj(threshold,hsv,frame)
  File "C:\opencv2.4.8\sources\samples\python2\Work.py", line 84, in trackObj
  while i &gt;= 0:
  ValueError: The truth value of an array with more than one element is ambiguous. Use       a.any() or a.all()
  </code></pre>
  
  <p>and when I add all() or any() in the specific line I get this error:</p>
  
  <pre><code>AttributeError: 'bool' object has no attribute 'all'
  </code></pre>
  
  <p>can anyone explain ?!!</p>