how to label the vacant space
1 次查看(过去 30 天)
显示 更早的评论
this is my coding that i have created..
I=imread('park2.jpg');
imshow(I);
gray=rgb2gray(I);
imshow(gray);
Binary = I;
BW = im2bw(Binary, graythresh(Binary));
BW = ~BW;
figure, imshow(BW)
L = bwlabel(BW);
s = regionprops(L, 'Centroid');
imshow(BW)
hold on
for k = 1:numel(s)
c = s(k).Centroid;
text(c(1), c(2), sprintf('%d', k), ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle');
end
hold off
however,the label is not right.. i want to label the vacant space only and want to display the output of vacant space.. this is how it goes http://s17.postimage.org/wimc8cbzz/parking.jpg
please help me solve this
采纳的回答
Geoff
2012-5-25
I wouldn't use regionprops here. That just connects pixels. You can't guarantee that will have anything to do with empty parking spaces in a thresholded image.
The first thing I would do is work out where the car parks are. I would do this manually if it's a fixed camera, but if I had to detect it I might try a hough transform looking for evenly-spaced groups of parallel lines. The point is that I would expect a certain structure - I wouldn't just go in blind, expecting the most basic of image processing techniques to work. Because in my opinion there is no real-world application for a totally automatic and calibration-free parking vacancy system.
Once I had a bounding rectangle for each park, I'd then look at all the pixels in each parking rectangle (or quad, if I expected any nontrivial camera rotation) and make the call on whether I think there's a car in that rectangle or not. To do that I would have heuristics relating to the size and shape (and colour) of pixel blobs, as well as their density and distribution within the rectangle. For example, if a person or shopping trolley was sitting in a vacant space, I might not want to detect it as a car.
4 个评论
Walter Roberson
2012-5-25
http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!