필터 지우기
필터 지우기

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 CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by