how to label the vacant space
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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
Risposta accettata
Geoff
il 25 Mag 2012
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 Commenti
Walter Roberson
il 25 Mag 2012
http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Segmentation and Analysis in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!