Free parking space detection

asked 2014-09-09 01:01:03 -0500

seidju gravatar image

updated 2014-09-09 01:29:51 -0500

Hello everyone!

I wanna start service of available parking spaces in different parking lots. The example of such parking lot is on picture below:

image description

So as you can see there's no parking lines, which could be tracked. So what is the simpliest method to count available parking spaces ?

I read few topics about it on StackOverflow, but it doesn't help. I guess the easiest algorithm could be next:

1) Create a some number of ROI of same size as all parking line ( for ex. line with green car):

image description

2) Make this ROI image grayscale

3)Make it blur and perform canny edge detection, maybe dilate:

image description

4) Find contours and approximate this contours with polylines:

image description

After it i need to approximate free empty space with rectangle to figure out how many cars can park on that parking spot. I found how to approximate contours with recnatgles, but how to do it with empty area, where is now contours at all?

There's other option: i could create a rectangle which is the same size as a car is (from camera point of view), than i move this rectangle from left side of roi to the right side, and count how many intersections this retagle will have with contours of ROI, if it's less than some number, it means, that it is a free parking spot.

I'm very new to OpenCV, and i need to make some progress in shortest time. I would really appreciate any help.

Thank you.

edit retag flag offensive close merge delete



Hmm to me it seems that the camera setup will be static. Just start by doing a manual segmentation once into regions. Why calculate parking spots? Then just match each content of a spot with a classifier (naive bayes or SVM) to see if it is a car or background.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-09-09 08:01:22 -0500 )edit

When i start to do it, i also thought about this seegmentation, but i couldn't find how to do it - is there some manual regarding this? As i understand i should manualy create "zones" , where car could park, ant then using SVM i will check this "zone" - is it a car, ot a empty space?

seidju gravatar imageseidju ( 2014-09-09 19:41:20 -0500 )edit

Yep. Let tbe user draw lines, store the points and use those regions as a mask to pass to your SVM classifier.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-09-10 01:15:52 -0500 )edit

Thanks a lot!

seidju gravatar imageseidju ( 2014-09-10 01:58:27 -0500 )edit

@seidju, Will you do something that works, can you share the code?

student5302 gravatar imagestudent5302 ( 2015-10-23 10:16:14 -0500 )edit