From XY array data in pixels to BW image

2 ビュー (過去 30 日間)
Alejandro Fernández
Alejandro Fernández 2020 年 11 月 18 日
コメント済み: Alejandro Fernández 2020 年 11 月 18 日
Hi, I have a XY array matrix called A , the first column are the X values (column of the image) and the second Y values (rows of the image) and I need to create a BW image in which the points of the A matrix get color white in the image.
As an example, the A data could be:
A = randi(20,[10 2])
And the image size should be , is that correct?
A = randi(20,[10 2]);
idx = sub2ind([20 20],A(:,2),A(:,1));
BW = false(20,20);
BW(idx) = true;

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 18 日
編集済み: Ameer Hamza 2020 年 11 月 18 日
A little mistake in the calculation of idx
idx = sub2ind([20 20],A(:,2),A(:,1)); % Last input shoule be A(:,1)
Rest is correct.
  1 件のコメント
Alejandro Fernández
Alejandro Fernández 2020 年 11 月 18 日
Thank you :D

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by