フィルターのクリア

how to label the vacant space

2 ビュー (過去 30 日間)
Syazwan
Syazwan 2012 年 5 月 24 日
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 件のコメント
Syazwan
Syazwan 2012 年 5 月 25 日
please...can anyone help me with this problem..:(

サインインしてコメントする。

採用された回答

Geoff
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 件のコメント
Syazwan
Syazwan 2012 年 5 月 25 日
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 2012 年 5 月 25 日
http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by