1

Here is my code:

for ts, blob in izip(ts_list, blobs):
    ts = simplecvimg.track("camshift", i, fgmask,b.boundingBox())
    print(ts)

Here is the error I get:

  if not ts and not img:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

While I understand from here ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() why one get's this error, I don't know what to do about this error in my situation. Any help will be appreciated!

Community
  • 1
  • 1
GradStudent
  • 166
  • 1
  • 3
  • 12
  • related?: https://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous – David Cary Sep 15 '20 at 20:44

1 Answers1

0

either ts or img is a numpy array ... as such it doesnt know what not <numpy.array> means

you probably want if len(ts) > 0 and len(img) > 0 , or maybe if ts is not None or something along those lines

>>> import numpy
>>> not numpy.array([1,2,3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: The truth value of an array with more than one element is ambiguous.
 Use a.any() or a.all()
Joran Beasley
  • 110,522
  • 12
  • 160
  • 179
  • The declarations are as follows: ts_list = [], with ts being each element in ts_list and f,img=cam.read(). I tried all 3 things you suggested to no avail. – GradStudent May 15 '14 at 19:49