<< return to Pixycam.com

Inconsistent results with Pixy2

Hi,

We are trying to use the Pixy2 in a project that involves detecting the colour of four balls out of five possible colours. Signatures 1-5 have been trained for blue, green, pink, purple and yellow. To reduce light variability (we thought), the balls are in a box so the only light is from the on-board lamp. We were hoping that this would mean that the Pixy2 would be able to reliably detect the balls every time.

However, what we are seeing is that the results are very inconsistent. If you see the attached images, they are taken a minute or so apart with the only difference being that power was removed/restored in between.

image4
image5

I should note that we do not want to re-teach the Pixy2 the colours every time we want the project to operate as this would not be practical.

Any suggestions on how we can get this working properly?

I noticed that the colours in the pictures are different (e.g. the cardboard roll on the right is more blue in the first image) and as I drove into work, I’ve been thinking about this. I can’t check right now as the Pixy2 is at home but the only differences in the environment between these two images are:

  • Potential brightness difference of on-board lamp
  • What the Pixy2 was doing at startup

If I assume that the on-board lamp can produce a consistent light after a few seconds, then I started thinking that perhaps a difference is that before the first image, the Pixy2 was started up in natural light before being placed in the box whereas for the second image, the Pixy2 was started up in the box.

I then checked this:
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:camera_pane

I am relatively sure that the “Auto White Balance on power-up” was set on the camera so I will try turning this off, placing the Pixy2 in the box before teaching signatures and then see if this produces consistent results after powering up again.

If you have another suggestion, please let me know otherwise I will try this tonight and report back.

Had a few minutes to briefly try this out tonight. Got much more consistent results in the few tests that I did. I’ll test further tomorrow, but if I don’t re-post here then you can assume that turning off “Auto White Balance on power-up” has fixed the problem.

It seems like the help sums up what I experienced…

Disabling Auto White Balance and Auto White Balance on power-up may be an effective way to retain the accuracy of your color signatures for a given environment.

Hello,
Disabling “Auto white balance on power up” can often resolve these kinds of issues. If your lighting is from the same source at all times, there is no reason to have “auto white balance on power up” enabled. With it enabled, the camera will white-balance with whatever it sees for the first 10 seconds that it is powered up. If it is looking at a colored object upon power-up it can affect the white-balance that is chosen for that power-cycle.

You can recalibrate the white balance at any time by pressing the button. This page describes how:

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:teach_pixy_an_object_2#white-balance

Edward