how to generate an image given 2D points coordinates and the gray intensity value

16 views (last 30 days)
hello,
i have a set of 2d points, and each point has a gray value. my goal would be to generate an image from these points.
now for the plotting i'm using the command plot.
plot3(pp_cnt(1),pp_cnt(2),pp_cnt(3),'dk','MarkerFaceColor', [P2.gr_lvl(jj) P2.gr_lvl(jj) P2.gr_lvl(jj)])
each pixel should have a 0.5x0.5 dimension.points.jpg
can anyone suggest me how to procede?
how can i generate an image? how can i interpolate these points?
  3 Comments
luca antonioli
luca antonioli on 29 Nov 2019
hi, i don t get what you are suggesting to me.. can you explain a little better? thanks!
darova
darova on 29 Nov 2019
Image pixels have rows and column (coordinates). Can't you use your coordinates to fill pixels?
for k = 1:length(x)
j = round(x - min(x)); % column
i = round(y - min(y)); % row
I(i,j) = 1;
end
imshow(I)

Sign in to comment.

Accepted Answer

Devineni Aslesha
Devineni Aslesha on 3 Dec 2019
Hi Luca
To generate an image with the given 2D point coordinates and the gray intensity value, use the imshow function in MATLAB. Also, in order to have 0.5 X 0.5 dimension for each pixel in the image, use the below code.
I = imread('Image.png');
R = imref2d(size(I), 0.5, 0.5);
imshow(I, R);
Refer to the following links for more information.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!