TXT 4.0 Camera and color detection

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Benutzeravatar
HansWw
Beiträge: 22
Registriert: 15 Dez 2014, 22:08

TXT 4.0 Camera and color detection

Beitrag von HansWw » 18 Nov 2021, 22:44

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?

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1831
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: TXT 4.0 Camera and color detection

Beitrag von Dirk Fox » 19 Nov 2021, 20:07

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

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1831
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: TXT 4.0 Camera and color detection

Beitrag von Dirk Fox » 19 Nov 2021, 20:17

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

Benutzeravatar
HansWw
Beiträge: 22
Registriert: 15 Dez 2014, 22:08

Re: TXT 4.0 Camera and color detection

Beitrag von HansWw » 20 Nov 2021, 11:05

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

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1831
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: TXT 4.0 Camera and color detection

Beitrag von Dirk Fox » 20 Nov 2021, 11:12

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

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1831
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: TXT 4.0 Camera and color detection

Beitrag von Dirk Fox » 20 Nov 2021, 12:56

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) 3374 mal betrachtet
Regards,
Dirk

Benutzeravatar
MasterOfGizmo
Beiträge: 2720
Registriert: 30 Nov 2014, 07:44

Re: TXT 4.0 Camera and color detection

Beitrag von MasterOfGizmo » 20 Nov 2021, 12:58

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
Arduino für fischertechnik: ftDuino http://ftduino.de, ftDuino32 http://ftduino.de/32

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1831
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: TXT 4.0 Camera and color detection

Beitrag von Dirk Fox » 20 Nov 2021, 13:02

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) 3369 mal betrachtet
Regards,
Dirk

Benutzeravatar
HansWw
Beiträge: 22
Registriert: 15 Dez 2014, 22:08

Re: TXT 4.0 Camera and color detection

Beitrag von HansWw » 20 Nov 2021, 15:54

Hello Dirk,

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

Regards,
Hans

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1831
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: TXT 4.0 Camera and color detection

Beitrag von Dirk Fox » 20 Nov 2021, 16:22

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

Benutzeravatar
Bjoern
Beiträge: 630
Registriert: 04 Jan 2018, 12:34

Re: TXT 4.0 Camera and color detection

Beitrag von Bjoern » 20 Nov 2021, 17:32

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?
https://gundermann-software.de/shop/
Der Shop für viele Community Projekte

Benutzeravatar
MasterOfGizmo
Beiträge: 2720
Registriert: 30 Nov 2014, 07:44

Re: TXT 4.0 Camera and color detection

Beitrag von MasterOfGizmo » 20 Nov 2021, 17:37

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.
Arduino für fischertechnik: ftDuino http://ftduino.de, ftDuino32 http://ftduino.de/32

Benutzeravatar
Bjoern
Beiträge: 630
Registriert: 04 Jan 2018, 12:34

Re: TXT 4.0 Camera and color detection

Beitrag von Bjoern » 20 Nov 2021, 18:34

Da reicht notfalls die Geschäftsleitung....

Aber das Sie diese Posts nicht lesen würden können Sie allerdings auch nicht behaupten ;)
https://gundermann-software.de/shop/
Der Shop für viele Community Projekte

Antworten