Ask Your Question

Revision history [back]

Use openCV for object+distance detection

Please help with guidelines/examples with the following project: Controlling a motor with Arduino (or ESP32), which is the easy part, for example a toy car, make it go forward or backwards and also control the speed.

Can I use a webcam connected to a laptop (later on it will be done by Raspberry pi) to identify the car and to assess the distance to the web cam? For example, let's assume cars are driving towards the web cam, not at the same time. if it is car #1, stop it 100 cm before the web cam. If it is car #2, stop it 20 cm before the web cam.

I am new to openCV, so I am not so sure if I can provide a size info for the images when being studied by the openCV. or can it assess the distance if I place an object with pre-known size. (e.g. 10 cm red pole) i am good with either method.

Another question about the web cam: currently I am using a simple one. I would like to consider a webcam with infrared transmitting LEDs, that will be able to work when it is dark. Recommendation for such cam will be appreciated.