Monster Self Drive - coloured track is black

Dear,

We have a question about the Monsterborg track in "monster-self-drive" mode.

The code for course recognition is made for colored tracks (red, blue, green) but is not made to drive the monsterborg on a black track.

We made several attempts to modify the code in the file "monster-self-drive/Settings.py" by changing values of MinHuntColor and MaxHuntColor so that the camera can recognize the black color of the course, but we did not succeed.

Can you show us how to adapt the code to make monsterborg self-drive
on a black course?

Thanks.

piborg's picture

Black is probably the hardest colour to tune for as shadows may also appear black to the camera.

The first thing to do is setup any lighting you will have on the track. The brightness and colour of your lighting may affect the detection. Sunlight should be fine as long as it is bright enough for the camera :)

Now you will need the script setup to show what it is detecting like this:

As the track is black the highlighting may not be very visible, so you may need to toggle overlayOriginal between True and False to get a clearer view:

As you are looking for black you want the minimum to be 0 for all channels:

minHuntColour = (  0,   0,   0)

Black will hopefully show as close to "grey", so I would start with all three values the same:

maxHuntColour = ( 50,  50,  50)

If too much of the image is highlighted reduce all three values together. If too little of the image is highlighted increase all three.

When the area is roughly right I would make a note of the level and then try tweaking individual levels. You are not after a perfect match, just a rough one.

When the image looks good try placing the MonsterBorg in different positions on the track and check it is still okay.

Once it all looks good set currentSpeed nice and low (say 0.4) and let the script try and follow the track. If it works you can raise the speed :)

Subscribe to Comments for "Monster Self Drive - coloured track is black"