フィルターのクリア

how to convert a table of coordinates into an images?

2 ビュー (過去 30 日間)
tba
tba 2014 年 8 月 18 日
回答済み: Image Analyst 2014 年 8 月 18 日
I want to convert a table of coordinates(x and y) into an image.how can I do this?

回答 (1 件)

Image Analyst
Image Analyst 2014 年 8 月 18 日
Try this:
grayScaleImage = zeros(ceil(max(y)), ceil(max(x)), 'uint8'); % Initialize to all zeros.
for c = 1 : length(x)
col = int32(x(c));
if col < 1
col = 1;
end
for r = 1 : length(y)
row = int32(y(r));
if row < 1
row = 1;
end
grayScaleImage(row, col) = 255; % or whatever value you want.
end
end
Assumes x and y go from 1 to some positive number. If x and y can be negative, you'll have to adjust the code.

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by