I designed the new program to reuse some parts of the image processing. My goal is to make the autopilot platform independent. You can run it on Windows, Linux or Mac. Therefore I came up with the idea of an processing chain. This looks as follows:
- Capture image
- Do some color conversion
- Select the region of interest
- Detect lanes and steering angle
- Write steering angle to virtual controller
Some chain elements are usable on all platform like the color conversion, lane detection, etc. But the image capturing libraries are not usable on every platform. With this architecture I only have to exchange the chain element for image capturing.
You can also change the lane detection method and tweak it a bit without touching the rest of the code. The result of one chain element is passed as input to the next chain member.
Currently I am working on the first chain members: Image capturing and image pre-processing.