# image.statistics(x,y,1,1)

**URL:** https://forums.openmv.io/t/image-statistics-x-y-1-1/151
**Category:** OpenMV Boards
**Created:** [November 17, 2016, 3:21pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151 "2016-11-17T15:21:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![m\_enfin](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@m\_enfin](https://forums.openmv.io/u/m_enfin)
#### Post date: [November 17, 2016, 3:21pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/1 "2016-11-17T15:21:02Z")

</div>

Hi,

In attached files, you find an image and a program that I wrote to explain my problem  
Can you tell me why the results of image.statistics (i, j, 1,1) are not equivalent to the image.rgb\_to\_lab () conversion function?

Why are not the circles drawn in blue on the test image?

The image.statistics function works perfectly in (sensor.GRAYSCALE)

thank you  
[tests\_OpenMV02\_imgStats.py](https://forums.openmv.io/uploads/short-url/8g7wSyDwEOc4yGNViqakCmtB2eo.py) (2.62 KB)  
 ![test_imgStats.jpg](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/1X/4a0738d969369aab6f1a64ce44023cc6eba39ea1.jpeg)

---

<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: [November 17, 2016, 4:43pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/2 "2016-11-17T16:43:55Z")

</div>

At job currently, will look at this tonight. What’s the magnitude of the difference?

---

<div class="post-metadata">

### Author: ![m\_enfin](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@m\_enfin](https://forums.openmv.io/u/m_enfin)
#### Post date: [November 17, 2016, 5:13pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/3 "2016-11-17T17:13:44Z")

</div>

The difference is important because image.statics () returns similar values for the three colors,

and the figures draw are only in white.

Sorry for the derangement, later

---

<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: [November 17, 2016, 6:03pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/4 "2016-11-17T18:03:19Z")

</div>

Ah!

I know the problem!

Stats has to be passed an roi=(i,j,1,1).

MP doesn’t really handle telling you you’re passing arguments to the function incorrectly. Currently, the stats function in your code is ignoring all arguments.

so: img.statistics(roi=(i,j,1,1))

Thanks,

---

<div class="post-metadata">

### Author: ![m\_enfin](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@m\_enfin](https://forums.openmv.io/u/m_enfin)
#### Post date: [November 17, 2016, 7:14pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/5 "2016-11-17T19:14:51Z")

</div>

That’s right, thank you for this debug, on the other hand what do you think for the circle that remains white when it should be blue?

---

<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: [November 17, 2016, 8:19pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/6 "2016-11-17T20:19:27Z")

</div>

You have to pass the color as a keyword argument:

img.draw\_circle(i, j, 12, color=color)

Please call the color tuple not “color” too. Call it red, etc.

[https://openmv.io/docs/library/omv.image.html#image.image.draw\_circle](https://openmv.io/docs/library/omv.image.html#image.image.draw_circle)

Please pay attention to the keyword arguments. If you don’t explicitly say the keyword then the argument is ignored.

We can actually make the function forgiving us this in the firmware, but, it gets rather tricky when you have multiple keyword arguments, etc. In the future I suppose the firmware will be built to be more forgiving.

---

<div class="post-metadata">

### Author: ![m\_enfin](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@m\_enfin](https://forums.openmv.io/u/m_enfin)
#### Post date: [November 17, 2016, 10:53pm UTC](https://forums.openmv.io/t/image-statistics-x-y-1-1/151/7 "2016-11-17T22:53:47Z")

</div>

Thanks for your quick and efficient replies, good night
