converting coordinates into pixel

4 views (last 30 days)
HYZ
HYZ on 25 Oct 2022
Answered: Image Analyst on 25 Oct 2022
Hi,
I have a 3D vector attached here (Mydots.mat). the first dimension is the number of spots, the second is the x,y coordinates of each spot and the third is number of frames. in each frame, the white spots are on grey background; basically they are moving across frames as coordinates change.
I would like to convert them in uint8 or double in 3D (Y,X,#frames) or 4D vector (Y,X,3,#frames) with grayscale intensity matrix of dimensions (Y, X) or a color matrix of dimensions (Y, X, 3).
I look at previous forum and didn't exactly get the discussion so I would like to ask again. Thanks.

Answers (1)

Image Analyst
Image Analyst on 25 Oct 2022
Not really sure what you want but I have this so far
s = load('Mydots.mat')
Mydots = s.Mydots;
[numDots, xy, numFrames] = size(Mydots)
for f = 1 : numFrames
thisFrameX = Mydots(:, 1, f);
thisFrameY = Mydots(:, 2, f);
plot(thisFrameX, thisFrameY, 'b.', 'MarkerSize', 15);
grid on;
xlim([-1000, 1000]);
ylim([-600, 600]);
caption = sprintf('Frame# %d of %d', f, numFrames);
title(caption, 'FontSize',16)
drawnow;
pause(0.1)
end
fprintf('Done!\n');
But do you want a volumetric image where some voxels have a gray level (and some are unassigned and thus zero)? If so, how is the gray level to be defined?
Or do you want an N-by-3 or 4 list of all the points like
x1, y1, f1, gl1
x2, y2, f1, gl2
x3, y3, f1, gl3
and so on for the other frames? This would not be a volumetric (3D) image but just a list of data. Again, how are the gray levels to be assigned?

Categories

Find more on Convert Image Type 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!