How to detect free parking space with counting?

5 次查看(过去 30 天)
I am newer to MATLAB programming.I want to know free parking space in numbers by using video processing MATLAB. Please help me in developing MATLAB code for this problem. Thanks in advance
  2 个评论
SURUTHI RAMAN
SURUTHI RAMAN 2019-6-6
I want to know automatic car parking space by using IR sensor MATLAB. Please help me in developing MATLAB code for this problem. Thanks in advance
Image Analyst
Image Analyst 2019-6-7
Suruthi, we can't be your project manager and guide you and direct you through the whole process from designing the major steps, to coding them up, to deciding on what hardware you need, to communicating with such hardware, to analyzing the final images or signals. We give quick answers that usually take us less than 5 minutes, and your need is NOT that. However the good news is that the Mathworks is ready, willing, and able to help you through the process. You can ask them here in this link

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2016-2-25
If you want something simple but maybe not as robust, then you can just have a template of where to look, and compare the empty lot image to an image with cars. Compare the mean and standard deviation of the empty and cars images to decide if there is a car in each spot or not.
  3 个评论
Image Analyst
Image Analyst 2016-2-25
I don't have any sophisticated code. Just subtract them and threshold
diffImage = double(carsImage) - double(backgroundImage);
binaryImage = abs(diffImage) > someValue;
imshow(binaryImage);
That code is not super robust with respect to night and day, sunny and cloudy, etc. but it's a start anyway. For more robustness you might have to have several backgrounds for different light levels and shadow locations.
Did you ever look at the link I sent you? I know for a fact that there are citations there to papers that have been published on the topic.
akhil kumar
akhil kumar 2016-2-26
Thank you so much for spending your valuable time.

请先登录,再进行评论。

更多回答(1 个)

Nadeem Mohd
Nadeem Mohd 2019-2-22
source = videoinput('winvideo',1); thresh = 25; im=getsnapshot(source); %(Remove this) bg = im;
% read in 1st frame as background frame(change this) %
bg = imread('C:\Users\Aatif\Desktop\Thesis\A2.PNG');
bg_bw = rgb2gray(bg);
% convert background to greyscale %fg1 = bg_bw;
% ----------------------- set frame size variables ----------------------- %fr_size = size(bg);
width = size(bg_bw,2); height = size(bg_bw,1); fg = zeros(height, width);
% --------------------- process frames -----------------------------------
for i = 2:100
fr = getsnapshot(source); % read in frame
fr_bw = rgb2gray(fr); % convert frame to grayscale
fr_diff = abs(double(fr_bw) - double(bg_bw)); % cast operands as double to avoid negative overflow
for j=1:width % if fr_diff > thresh pixel in foreground
for k=1:height
if ((fr_diff(k,j) > thresh))
fg(k,j) = 1;
else
fg(k,j) = 0;
end
end
end
%bg_bw = fr_bw;
figure(1),subplot(2,1,1),imshow(fr)
%subplot(3,1,2),imshow(fr_bw)
subplot(2,1,2),imshow(fg)
M(i-1) = im2frame(uint8(fg),gray); % put frames into movie
if ((bg_bw) ~= (fr_bw))
textIn = ('Car has left the parking lot');
ha = actxserver('SAPI.SpVoice');
invoke(ha,'speak',textIn);
h = msgbox('Car has left the parking lot');
else
textIn = ('Car is in the parking lot');
ha = actxserver('SAPI.SpVoice');
invoke(ha,'speak',textIn);
h = msgbox('Car is in the the parking lot');
end
end
above is my code
i cant read if statment
its just reading else statment
can please some on help to solve this issue

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by