How to dilate a straight line width?

1 回表示 (過去 30 日間)
peyush
peyush 2015 年 7 月 16 日
コメント済み: peyush 2015 年 7 月 17 日
I have a binary image having a finite straight line at arbitrary angle...I need to dilate the image in such a way that the line width increases after dilation without changing/dilating its length...how should I do this...any help is highly appreciated

採用された回答

Image Analyst
Image Analyst 2015 年 7 月 17 日
It's just a bit of algebra. You need to find the perpendicular lines at the endpoints. The slope is -1 over the slope of the main line. Then you can use point slope formula like you learned in 10th grade. Do that for each endpoint. I think you can do this because you're a talented engineer. Then use the 4 line segment endpoints and plug into poly2mask(). Then dilate and multiply by the mask to "chop off" the ends.
mask = poly2mask(x,y,rows,columns);
fatLineImage = imdilate(binaryImage, true(30));
finalImage = fatLineImage .* uint8(mask);
  1 件のコメント
peyush
peyush 2015 年 7 月 17 日
thanks I got it right

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by