Seite 1 von 1

TXT 4.0 Camera and color detection

Verfasst: 18 Nov 2021, 22:44
von HansWw
I've a problem with the color detection with the camera on the new TXT 4.0 Controller.
When I run the program 'camera_detect_color' there is no color detection at all.
It doesn't matter if use a red, green or yellow plate, the RGB-value is constantly fluctuating, random it seems.
See this video.
Is there anyone who has this working?

Re: TXT 4.0 Camera and color detection

Verfasst: 19 Nov 2021, 20:07
von Dirk Fox
Hi Hans,

I just had a look at the code. The color detection is configured with a "hue tolerance" of one degree.
The hue coding converts the RGB color code into a 360° color circle position.
To meet the right color with only one degree tolerance is challenging... especially with artificial light.
Try to increase the tolerance (up to 30° should be possible), and the color recognition should work perfectly.

Regards,
Dirk

Re: TXT 4.0 Camera and color detection

Verfasst: 19 Nov 2021, 20:17
von Dirk Fox
Hi Hans,
HansWw hat geschrieben:
18 Nov 2021, 22:44
It doesn't matter if use a red, green or yellow plate, the RGB-value is constantly fluctuating, random it seems.
that's unavoidable (and normal): with RGB coding it is nearly impossible to identify the color (because there is a great range of valid combinations of R, G and B). That's why fischertechnik converts the RGB code into hue.

For more details, see fischertechnik Robotics: Topic Introduction ("How does RGB colour code work?").

Regards,
Dirk

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 11:05
von HansWw
Hello Dirk,

Thank you for your answer(s)!
I've tried your advise to increase the HUE tolerance to 30°.
But it's still not working.
I tried a different camera, no result.
I enlarged the camera reach to the maximum, no result.
I build in some wait time in de program loop, no result.

And finaly I build in another dectection color : black (#000000) with a hue tolerance of 30°.
If black is detected, all status indicators will be active.
And indeed if the camera is covered completely the RGB = #000000 and de status indicators are active.
But when there is the slightest light: RGB is #010000 or #000001 or whatever the color black is not recognised.
So I think the conclusion is: The hue-function doesn't work at all!!

Regards,
Hans

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 11:12
von Dirk Fox
Hi Hans,

you are right! I tested it yesterday evening, with the same result... There must be a problem with the color (hue) calculation.
It worked some month ago, but I suppose they changed something and didn't test it again.

I am in contact with fischertechnik and will report the error.

Regards,
Dirk

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 12:56
von Dirk Fox
Hi Hans,

here is my solution - hue calculation "by hand". I implemented it for the "fischertechnik education base set".
I just tested it - it is (still) working.
Camera_Color_Decoder.ft
Camera_Color_Decoder.ft
Camera_Color_Decoder.jpg (90.5 KiB) 5852 mal betrachtet
Regards,
Dirk

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 12:58
von MasterOfGizmo
Fischer will soon release the TXT-4.0"s full source code to comply with the licenses. We can then simply take a look ourselves and see where the problem is and how to fix it

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 13:02
von Dirk Fox
And here is the appropriate display configuration:
Camera_Color_Decoder_Display_Configuration
Camera_Color_Decoder_Display_Configuration
Camera_Color_Decoder - Display Configuration.jpg (41.92 KiB) 5847 mal betrachtet
Regards,
Dirk

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 15:54
von HansWw
Hello Dirk,

I implemented your solution - hue calculation "by hand" and it's working fine.
Thank you.

Regards,
Hans

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 16:22
von Dirk Fox
Hi Hans,

in my solution I did not separately distinguish the "colors" white and black. It's easy to add this, if you need it: For black, all three RGB values are significantly smaller than 50, for white, they are all bigger than 200. The exact (or best) value depends on the general brightness.

Regards,
Dirk

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 17:32
von Bjoern
Till,

da ich im anderen Thread nicht schreiben kann. Ich bin mal auf die Antwort von fischer gespannt wg. dem Sourcecode gespannt.
Hast du diese auch direkt wegen der Lizenzverletzung kontaktiert?

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 17:37
von MasterOfGizmo
Nö ... sollte ich sie direkt kontaktieren? Ich wüsste nicht wen dort. Ich kenne keinen aus deren Rechtsabteilung. Auf diesem Weg klappt das bestimmt auch.

Re: TXT 4.0 Camera and color detection

Verfasst: 20 Nov 2021, 18:34
von Bjoern
Da reicht notfalls die Geschäftsleitung....

Aber das Sie diese Posts nicht lesen würden können Sie allerdings auch nicht behaupten ;)