Use openCV for object+distance detection

asked 2020-05-17 15:01:01 -0500

YigalB gravatar image

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.

Thanks

edit retag flag offensive close merge delete

Comments

far too broad to be answered.

please do own research, split problem into small steps, try on your own again, and ask about specific things

berak gravatar imageberak ( 2020-05-18 04:42:29 -0500 )edit

@YigalB. Yes, u can used webcam... Fortunately, laptop comes with built in camera. if it is car #1, stop it 100 cm before the web cam.. u tell GPIO to stop and delay for 5 sec to fowrard or backward or left or right. Same as 20cm too.Yes, u can do 10 cm red pole or stop sign by using opencv. I used both webcam and picamera. The picamera is better. Btw, I haven't try ESP32 yet. I still have it.

supra56 gravatar imagesupra56 ( 2020-05-19 22:11:35 -0500 )edit

How many HRS04 sensors? U should have 3...left, centre and right.

supra56 gravatar imagesupra56 ( 2020-05-19 22:15:16 -0500 )edit