Ask Your Question

Parking distance calculation for a car

asked 2018-04-30 06:42:46 -0600

Trudesagen gravatar image

I want to make a parking assistant in my garage, by using a camera and opencv. My idea was to place to camera on the ceiling, very close to the wall ( max 20cm from the wall) looking down. Angling the camera so the corner between the wall and the floor is visible in the video.

I then want to calculate the distance from the wall to my car as it is backing into the garage. It should be able to handle a situation if the car comes in at an angle to the wall.

Assumptions and known variables:

  • Ground is flat
  • Height from camera to floor is known
  • Camera is calibrated

I am able to detect the line the edge between my wall and floor makes, by using canny edge detection and hough transform. As I know its pixel position and its world Z position from the camera, I can easely calculate its X and Y coordinates in the world.

My problem is with the car. I am not able to get a proper detection of the edge of the car as it moves into the garage. The other problem being tracking it when i first find it.

I thought of other solutions like detecting the gap my car and wall makes instead. I am quite new to OpenCV, so I am not too sure where to start with this.

If anyone could point me in the right direction, or know a good solution to this problem, that would be much appreciated.

edit retag flag offensive close merge delete



You probably want to use the background segmentation functions. They will definitely help with detecting the car, and probably with knowing when to activate.

Tetragramm gravatar imageTetragramm ( 2018-05-01 19:16:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-05-02 02:35:46 -0600

Trudesagen gravatar image

That is a very good suggestion, I will definitely try this. Makes sense as everything in the image is static except the for the car. So many modules in openCV, glad you pointed me to this one.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-04-30 06:42:46 -0600

Seen: 377 times

Last updated: Apr 30 '18