After finding a group of green pixels, we cut out a quadratic region of interest that is slightly larger than the green turning signal. This ROI now contains the green dot itself and a few black pixels that belong to the black line of the intersection. To decide which way we have to turn, we calculate the average position of the black pixels in this ROI. If the position is in the bottom of our ROI, we should ignore the green because there is a black line right below it. If the average black position is in the top right, we turn left (because there are black lines at the right and top of the ROI) and if it is left, turn right respectively. I would recommend checking out section 4b of our TDP (can be found on our website under "BitFlip" -> "robots" -> "2024") for further information.
I feel dumb for watching this. Then again not as dumb as seeing the problem happen over and over and repeating it.
I guess it will take a few more years before the robots are taking over...
How do you get the amount of turning motors after found a green signal?
After finding a group of green pixels, we cut out a quadratic region of interest that is slightly larger than the green turning signal. This ROI now contains the green dot itself and a few black pixels that belong to the black line of the intersection.
To decide which way we have to turn, we calculate the average position of the black pixels in this ROI. If the position is in the bottom of our ROI, we should ignore the green because there is a black line right below it. If the average black position is in the top right, we turn left (because there are black lines at the right and top of the ROI) and if it is left, turn right respectively.
I would recommend checking out section 4b of our TDP (can be found on our website under "BitFlip" -> "robots" -> "2024") for further information.