The idea is to follow the cracks in the floor, or the cracks/grout in the floor tiles.
Process right now is:
- convert image to grayscale
- blur it a little
- mask to area immediately in front of the bot
- compute thresholds for edge detection
- perform canny edge detection
- find probable lines on unmasked detected edges
then figure out:
7) the closest, most nearly vertical line
8) direction to drive to be “on” the line
9) direction to drive to stay on the line
I should add that the image tested is 1092 x 819. I need to test resizing the image to 320x240 or capturing at that resolution to see if I can speed up the process without hurting the line detection.
This is what it would look like if I didn’t mask to the area in front of the bot:
That is a lot of unnecessary processing that would slow finding the one line to follow.
This will be a special case of “line following” for straight segments. General line following tends to use a different algorithm but this is what came to mind with the OpenCV skills I have. Probably should have done some research instead of jumping into “code slinging”.
That compute thresholds step is also going to be an area of research as lighting, colors, and contrast vary as the bot moves and the house lights come on and off. This may be the most challenging thing to figure out.