I’m working on a school project and basically, I have a vehicle moving between 2 walls with a camera at the top, looking at the truck from an aerial view. I have a motor controlling the truck externally(don’t worry about this) but I need to measure how close the truck gets to the walls on either sides which I’ll feed into my existing code that makes the truck move. How could I go about this?
I’ve thought about different ways of doing this.
- I have used Canny edge detector to get the edges of the vehicle and wall but don’t know how to measure the distance between the edges.
- I’ve thought about using contours but also don’t know how to get the distance between 2 contours in a video feed.
- I’ve also thought about ditching the measurements from the walls and get how far to the left or right the truck moves (since I already know the width of the road), and then stop the truck when it moves too much in either direction so it doesn’t hit a wall, but with that, when it comes to a bend in the road, the truck will completely stop when turning.
I can’t think of any other way to do this. I need help with the Python code to be able to do this.
New contributor
Simisoluwa Dada is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.