parking space using IMAGE PROCESSING

20 ビュー (過去 30 日間)
vinoth bala T
vinoth bala T 2019 年 10 月 21 日
コメント済み: Image Analyst 2020 年 1 月 17 日
clc;
close all;
clear all;
%image acquisition
f=imread('C:\Users\vinoth\Downloads\jph.jpg');
f=imresize(f,[800 NaN]); % image loading unit
figure (1)
imshow(f)
g=rgb2gray(f);
g=medfilt2(g,[5 5]);
figure (2)
imshow (g)
% morphological image processing
conc=strel('disk',5);
gi=imdilate(g,conc);
conc1=strel('disk',5);
ge=imerode(gi,conc1); % morphological image processing
gdiff=imsubtract(gi,ge);
gdiff1=mat2gray(gdiff);
figure (4)
imshow (gdiff1)
gdiff2=conv2(gdiff1,[1 1;1 1]);
figure (5)
imshow (gdiff2)
gdiff3=imadjust(gdiff2,[0.4 0.9],[0 1],1);
figure (6)
imshow (gdiff3)
B=logical(gdiff3);
[a1 b1]=size(B);
figure(7)
imshow(B)
er=imerode(B,strel('line',60,8));
figure(8)
imshow(er)
out1=imsubtract(B,er);
F=imfill(out1,'holes'); %filling the object
H=bwmorph(F,'thin',0.5);
H=imerode(H,strel('line',8,55));
figure(9)
imshow(H)
%Normalization% & Object Recognition
I=bwareaopen(H,floor((a1/18)*(b1/18)));
I(1:floor(.9*a1),1:2)=1;
I(a1:-1:(a1-20),b1:1:(b1-2))=1;
figure(10)
imshow(I)
%Cars detection in image
figure (11)
imshow pair (f,I)
%Create bounding box on detected cars
Iprops=regionprops(I,'BoundingBox','Image');
hold on
text(8,785,strcat('\color{green}Cars Detected:',num2str(length(Iprops))))
hold on
for n=2:size(Iprops,1)
rectangle('Position',Iprops(n).BoundingBox,'EdgeColor','g','LineWidth',2);
end
result = sprintf('Number of cars: %d.',n-1);
disp(result);% display number of cars
hold off
i am trying to do a project for parking space detection using image processing , the above program is the code ive been working on, whenever i am trying to run the code , it shows an error like this
??? Error using ==> imageDisplayParsePVPairs at 72
Invalid input arguments.
Error in ==> imageDisplayParseInputs at 70
[common_args,specific_args] = imageDisplayParsePVPairs(varargin{:});
Error in ==> imshow at 199
[common_args,specific_args] = ...
i am not expert in matlab, i am a student trying to do a report on IMAGE PROCESSING if someone know what is the problem in this code?... if knew explain this to me.. i copied this code i didnt write this...

採用された回答

Guillaume
Guillaume 2019 年 10 月 21 日
You've cut the error message and removed the most important bit, the last part which told you which line of your code is responsible for the error.
I'm guessing it may be this line:
imshow pair (f,I)
which should be written
imshowpair(f, I)
with no space between imshow and pair.
  3 件のコメント
Guillaume
Guillaume 2019 年 10 月 21 日
Maybe it's time to upgrade?
As per its documentation imshowpair requires at least R2012a, so you can't use that function. For this particular case, I think your imshowpair call may be equivalent to:
imshow(cat(3, I, rgb2gray(f), I));
vinoth bala T
vinoth bala T 2019 年 10 月 21 日
thank you sir

サインインしてコメントする。

その他の回答 (1 件)

Thoms Csa
Thoms Csa 2020 年 1 月 17 日
Hi,
Sorry, this is not an answer, but I'm a student too, trying to do exacly the same report on car detection.
I wonder if you finally found out how to detect cars, and I hope you wouldn't mind sharing your work with me.
Thanks
  1 件のコメント
Image Analyst
Image Analyst 2020 年 1 月 17 日
Is your camera looking at the same scene? Or do you have multiple different lot locations you're monitoring? Please start a new question and attach your images. You'll need several images, especially one of the lot with no cars at all in them, and possibly at different times of day because that will affect the lighting and shadows on the scene. Plus some images with cars of various colors, especially cars with colors like the asphalt or concrete roadway, which will make it difficult to find those cars.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by