Convert line to pixels in a image, from coordenade

10 ビュー (過去 30 日間)
Josep Llobet
Josep Llobet 2021 年 9 月 6 日
コメント済み: Josep Llobet 2021 年 9 月 7 日
Hi there,
I have the coordenades of two points, which with the function line() I can draw a line. I want to convert the pixels of the original image which belong the line between the two points. The image is binary.
In a graphical way: am trying to convert the pixels which go through the yellow line, in an automated way.
I am conscious that I could use the manually code, as example:
1 = BW_image(45:50, 65:70)
but I am trying to make it in a automated way.
Thank you!

採用された回答

Matt J
Matt J 2021 年 9 月 6 日
編集済み: Matt J 2021 年 9 月 6 日
One way.
T=false(size(BW_image));
T(A(1), A(2))=1; %line end point 1
T(B(1), B(2))=1; %line end point 2
BW_image=BW_image|bwconvhull(T);
  1 件のコメント
Josep Llobet
Josep Llobet 2021 年 9 月 7 日
You nailed it!
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by