Parking distance calculation for a car

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

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

Comments

2

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 -0500 )edit

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.

Trudesagen gravatar imageTrudesagen ( 2018-05-02 02:35:46 -0500 )edit