Free parking space detection
Hello everyone!
I wanna start service of available parking spaces in different parking lots. The example of such parking lot is on picture below:
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):
2) Make this ROI image grayscale
3)Make it blur and perform canny edge detection, maybe dilate:
4) Find contours and approximate this contours with polylines:
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.
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.
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?
Yep. Let tbe user draw lines, store the points and use those regions as a mask to pass to your SVM classifier.
Thanks a lot!
@seidju, Will you do something that works, can you share the code?