converting coordinates into pixel

4 次查看(过去 30 天)
HYZ
HYZ 2022-10-25
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.

回答(1 个)

Image Analyst
Image Analyst 2022-10-25
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?

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by