Você está na página 1de 7

PROGRAM AND CODE

a=imread('project.jpg');
imshow(a);
b=rgb2gray(a);
figure,imshow(b);
c=im2bw(b);
figure,imshow(c);
d=imcomplement(c);
figure,imshow(d);
BW2 = imerode(d,SE);
figure,imshow(BW2);
ref=imread('car.png');
imshow(ref);
img=im2bw(ref);
img1=imcomplement(img);
img2=imfill(img1,'holes');
figure,imshow(img2);
y=bwarea(img2)
z=0.6*y
[L,NUM]=bwlabel(BW2);
for i=1:NUM
imshow(L==i);
area=bwarea(L)
if X>z &&X<y
disp('valid slot');
end
pause(2);

stats = regionprops(L,'Centroid');
centroid=stats.Centroid
pause(2);
end

Prototype car parking space

Compliment of the image

Reference image of a car

Compliment of the reference image

Segmented image of 1 parking slot

Segmented image of 2 parking slot

Segmented image of 3 parking slot

Segmented image of 4 parking slot

Y=area of reference image


Z=60% area of reference image
Area=Area of object in parking slot

If z<area<y then the object in the slot is considered a car