inverse_binary=not(handles.bw);
[handles.Lhandles.Num_object]=bwlabel(inverse_binary);
set(handles.text2,'string',10-handles.Num_object);

6 件のコメント

Soniya Jain
Soniya Jain 2021 年 7 月 9 日
Can you clarify, what does set and bwlable do ?
Walter Roberson
Walter Roberson 2021 年 7 月 9 日
L = bwlabel(BW) returns the label matrix L that contains labels for the 8-connected objects found in BW.
set() changes the properties of an object. In particular, the property named string of the object designated by handles.text2 will be changed to reflect the value 10-handles.Num_object
Saktheeswaran Mohan
Saktheeswaran Mohan 2021 年 7 月 10 日
How does code working in matlab?
inverse_binary=not(handles.bw)
Saktheeswaran Mohan
Saktheeswaran Mohan 2021 年 7 月 10 日
How can i explain if anyone asking me how does code working in matlab? I used that code for getting ouput for Available slots in Image processing method , I mentioned below that code which are i used for my project.
handles.output=hObject;
inverse_binary=not(handles.bw);
[handles.Lhandles.Num_object]=bwlabel(inverse_binary);
set(handles.text2,'string',10-handles.Num_object);
imshow(handles.L, 'parent',handles.axes2);
guidata(hObject,handles);
Walter Roberson
Walter Roberson 2021 年 7 月 10 日
We assume that handles.bw has been assigned the result of thresholding the image into black and white, 0 and 1. The "not" operator takes logical negation, replacing false (0) with true (1) and true (1) with false (0). The result effectively reverses black and white -- reverses foreground and background.
For example if you were looking black text on white background then the text would be 0, but (by convention) the processing routines such as labelling work mostly on 1s, so you want to change the black-on-white to white-on-black
Walter Roberson
Walter Roberson 2021 年 7 月 10 日
Imagine a case where the parking lot pavement is pretty much black, and the cars are distinguishablely something brighter. Then you threshold the image. The black parking lot would be 0 and the cars would be 1. Now take the logical negation so that the 0 (pavement) becomes 1 and the 1 (cars) becomes 0. Now you can label the result, and each blob of 1s will correspond to a section of adjacent available parking spaces.
Questions for you to think about:
  • how can you distinguish between adjacent available spaces? Are the edges of the spaces marked?
  • how can you deal with black cars, since those are dark too?

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

 採用された回答

Walter Roberson
Walter Roberson 2021 年 7 月 9 日

0 投票

inverse_binary=not(handles.bw);
[handles.L, handles.Num_object]=bwlabel(inverse_binary);
set(handles.text2,'string',10-handles.Num_object);
You were missing a comma.

その他の回答 (1 件)

Steven Lord
Steven Lord 2021 年 7 月 9 日

0 投票

doc not
doc bwlabel
doc set

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2021a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by