I am working about smart parking system with video processing and ı need to scan just special area for image processing so imagine a parking area, we need to scan just parking area.So how can we scan special area in matlab with video processing?

7 次查看(过去 30 天)
vid=videoinput('winvideo',1,'YUY2_320x240'); set(vid,'FramesPerTrigger',Inf); set(vid,'ReturnedColorspace','rgb') vid.FrameGrabInterval=10; start(vid); while(vid.FramesAcquired<=1000) data=getsnapshot(vid); section1=data(1:100,:,:); section2=data(140:239,:,:); y=zeros(240,320,3); y(1:100,:,:)=section1; y(140:239,:,:)=section2; y=uint8(y);
%% Im=y; rmat=Im(:,:,1); gmat=Im(:,:,2); bmat=Im(:,:,3);
%%Plot the data levelr=0.5; levelg=0.5; levelb=0.5; i1=im2bw(rmat,levelr); i2=im2bw(gmat,levelg); i3=im2bw(bmat,levelb); Isum=(i1&i2&i3);
Icomp=imcomplement(i3); Ifilled=imfill(Icomp,'holes');
se=strel('disk',10); Iopenned=imopen(Ifilled,se);
Iregion=regionprops(Iopenned,'centroid'); [labeled,numObjects]=bwlabel(Iopenned,4); stats=regionprops(labeled,'Eccentricity','Area','BoundingBox'); areas=[stats.Area]; eccentricities=[stats.Eccentricity]; idxOfSkittles=find(eccentricities); statsDefects=stats(idxOfSkittles); imshow(data);
for idx=1:length(idxOfSkittles) h=rectangle('Position',statsDefects(idx).BoundingBox); set(h,'EdgeColor',[.75 0 0]);
end
hold off; end
if idx>10 title('there are',num2str(numObjects),'objects in'); end
hold off; clear all;

采纳的回答

Image Analyst
Image Analyst 2018-5-20
Also post a no-car image plus an image with cars parked some of the spaces.
  3 个评论
Baris Altunhan
Baris Altunhan 2018-5-21
I did search about some thing , but ı could not find any thing, can you help me sir, what am i gonna do in this situation? ı need to scan just some area and ı need to decide empty parking area and ı need to plot green rectangle that is empty area

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by