Filter löschen
Filter löschen

how to label the vacant space

2 Ansichten (letzte 30 Tage)
Syazwan
Syazwan am 24 Mai 2012
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
  1 Kommentar
Syazwan
Syazwan am 25 Mai 2012
please...can anyone help me with this problem..:(

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Geoff
Geoff am 25 Mai 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 Kommentare
Syazwan
Syazwan am 25 Mai 2012
could you guys give me a sample coding or example because i am new in this matlab world..
if there is an example,i can make it as my reference..
by the way,thank a lot for gave me some advice...
Walter Roberson
Walter Roberson am 25 Mai 2012
http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by