How to detect free spots in a parking area?

3 visualizzazioni (ultimi 30 giorni)
Hello All,
I am working on a project which is to detect vacant spots in a park. I have a row of 10 spots on a small model just like in the images attached here:
I want to write a program that tells the webcam to take an image and when there is motion, take another image and compare the two to tell how many spots are available.
Please provide a source code with any explanation that you know will aid me.
Thank you.
  4 Commenti
Hazman Mat Husin
Hazman Mat Husin il 22 Nov 2018
Hi hazha, im from uthm and my final project is about this.. can i get the coding please?if you there please email me at hazmanmathusin@yahoo.com
Pratiksha Pradhan
Pratiksha Pradhan il 7 Ott 2020
Hello, I am doing something similar for an undergraduate school project. Could you please share your code for reference?

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 20 Apr 2014
See my attached demo that detects motion in a video. You'll just have to replace read() with getsnapshot(), or snapshot if you're using the new webcam add-on introduced with R2014a.
To see if a parking spot is taken, just compare the color in the known locations to black. Do it for every color channel.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Get means in the rectangle of this parking place.
redMean = mean2(redChannel(row1:row2, col1:col2));
greenMean = mean2(greenChannel(row1:row2, col1:col2));
blueMean = mean2(blueChannel(row1:row2, col1:col2));
% Set a flag to say if it's taken or not.
taken = abs(redMean - redBlack) > tolerance & abs(greenMean- greenBlack) > tolerance & abs(blueMean - blueBlack) > tolerance;
Of course you have to know row1, row2, col1, and col2 for every location that you want to inspect, but that's no problem. Then repeat the above code for every parking spot. You might make taken be an array.
You should check Vision Bibliography. There are published papers on this. I assume this is an undergraduate project so you might be able to get away with just copying known methods. If it's a graduate project, then you're going to have to invent something totally new to the world or else improve on the methods that have already been published.
Huang, C.C.[Ching-Chun], Wang, S.J.[Sheng-Jyh],
A Hierarchical Bayesian Generation Framework for Vacant Parking Space Detection,
CirSysVideo(20), No. 12, December 2010, pp. 1770-1785.
Suhr, J.K.[Jae Kyu], Jung, H.G.[Ho Gi],
Sensor Fusion-Based Vacant Parking Slot Detection and Tracking,
ITS(15), No. 1, February 2014, pp. 21-36.
Suhr, J.K.[Jae Kyu], Jung, H.G.[Ho Gi], Bae, K.[Kwanghyuk], Kim, J.[Jaihie],
Automatic free parking space detection by using motion stereo-based 3D reconstruction,
MVA(21), No. 2, February 2010, pp. xx-yy.
and so on.
  37 Commenti
Image Analyst
Image Analyst il 6 Mar 2022
Just to build on what Walter said, I'm sure you'd spend way more time trying to develop an image processing program to identify spaces than if you just hand drew them. I mean, why spend days or weeks trying to develop a program to automatically identify spaces when you can hand draw them in a few minutes? If you have a parking lot image, just upload it and I can give you back the mask with just a few minutes work.
Cristian Cuenca Moreno
Cristian Cuenca Moreno il 7 Mar 2022
Ok, thaks
My objective was to build a code trained to do it itself whit some lines but if its very tedious, its better to draw it

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by