How to set the label of a object manually

4 ビュー (過去 30 日間)
Soumya Behera
Soumya Behera 2015 年 12 月 15 日
編集済み: Soumya Behera 2015 年 12 月 15 日
As the bwlabel command assigns the labels on a specific sequence and not according to the user .I want to use it to label a collection of arrows in a binary image according to the sequence I set . I also tried doing the same using for loop for a binary image (521*441),but here i had to enter the values many times (229761) please suggest an alternative I want the program to show me the object and ask the user to set the label for the object.

回答 (1 件)

Adam
Adam 2015 年 12 月 15 日
編集済み: Adam 2015 年 12 月 15 日
L = bwlabel(BW, 4);
myLabels = [77, 55, 22, 7];
L = myLabels( L+1 );
will relabel 4 labelled objects with user-defined labels, where BW is your original binary image. In this case I hard-coded the number of labels to 4. If you have an unknown amount of labels then the number of such labels is just max( L ) + 1 so you need to have that many labels in your 'myLabels' array, otherwise any labels beyond that will just remain unchanged from their defaults.
How you choose to put that array of 'myLabels' together is something of a different question.
  10 件のコメント
Adam
Adam 2015 年 12 月 15 日
Once you have identified the objects you have to determine which is which if you want specific labels for specific objects, but how you choose to do that is more complicated than the actual relabelling once you have determined your mapping from the original labels to your new labels.
I don't know what order bwlabel labels objects in or whether you want an interactive way for the user to click an object and give it a label or some automated way with hard-coded labels like above.
Soumya Behera
Soumya Behera 2015 年 12 月 15 日
編集済み: Soumya Behera 2015 年 12 月 15 日
Yes I wanted an interactive way for the user to click an object and give it a label .Please suggest me a way . Do you have any other way by which I can reach from starting to the end point where starting point is top left rectangle in 'hogaya.png'

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

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by