how to create convex hull from white pixels

2 ビュー (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2019 年 8 月 9 日
コメント済み: darova 2019 年 8 月 9 日
Dear All
I attach my image. The red circle annotates the white line I need to trace. The endpoints of this white line are annotated with small red circles as you may be able to see. I need an algorithm to automatically trace first and last white pixels of this small line/contour and create a convex hull.
Any help please?

回答 (1 件)

Neuropragmatist
Neuropragmatist 2019 年 8 月 9 日
You can use bwlabel to label parts of a binary image, but your line is broken so you will have to dilate the image first to make it a solid/complete line:
Then you will need to find a way to discriminate your line from the others in the image, it's not the biggest or the lowest in the image so I don't really know how you will do that.
As for a convex hull, once you have the pixels related to your line you can get their indices and convert them to subscripts using sub2ind, then pass these to something like convhull as if they were x,y coordinates.
Hope this helps,
M.
  1 件のコメント
darova
darova 2019 年 8 月 9 日
After using imdilate() it can be the largest or the second largest
img1.png

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

カテゴリ

Help Center および File ExchangeBounding Regions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by