# Error with img.binary

**URL:** <https://forums.openmv.io/t/error-with-img-binary/276>\
**Category:** OpenMV Boards\
**Created:** [June 1, 2017, 10:01pm UTC](https://forums.openmv.io/t/error-with-img-binary/276 "2017-06-01T22:01:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zlite](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zlite](https://forums.openmv.io/u/zlite)\
**Post date:** [June 1, 2017, 10:01pm UTC](https://forums.openmv.io/t/error-with-img-binary/276/1 "2017-06-01T22:01:38Z")

</div>

I’m getting the weirdest errors with the latest firmware (2.4) and binary filtering:

If I use “img.binary(0, 83, -128, 15, -128, 127)” it works.

But if I do this:

> threshold = (0, 83, -128, 15, -128, 127)  
> img.binary(threshold)

I get the attached error:

 ![IMG_20170601_143158.jpg](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/1X/2f28852014d07ab1e34a3a54d9b9e98219fb73c1.jpeg)

---

<div class="post-metadata">

**Author:** ![deshipu](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/deshipu/32/8_2.png) [@deshipu](https://forums.openmv.io/u/deshipu)\
**Post date:** [June 2, 2017, 7:08am UTC](https://forums.openmv.io/t/error-with-img-binary/276/2 "2017-06-02T07:08:42Z")

</div>

Try

```python
img.binary(*threshold)

```

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [June 2, 2017, 3:21pm UTC](https://forums.openmv.io/t/error-with-img-binary/276/3 "2017-06-02T15:21:08Z")

</div>

Neither worked… The first just didn’t give an error.

It’s a list of tuples. So [(12, 1, 1, 1, 1, 12)].

---

<div class="post-metadata">

**Author:** ![zlite](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zlite](https://forums.openmv.io/u/zlite)\
**Post date:** [June 3, 2017, 9:35pm UTC](https://forums.openmv.io/t/error-with-img-binary/276/4 "2017-06-03T21:35:57Z")

</div>

Thanks guys. I ended up going with:

> img.binary([thresholds[threshold\_index]])

Looks weird, but seems to work!

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [June 3, 2017, 9:45pm UTC](https://forums.openmv.io/t/error-with-img-binary/276/5 "2017-06-03T21:45:06Z")

</div>

> [@](#):
>
> Thanks guys. I ended up going with:
> 
> > img.binary([thresholds[threshold\_index]])
> 
> Looks weird, but seems to work!

I think this should work as well:

```python
thresholds[index:index+1]

```
