GPU: Iteratively adding 2D gaussians to a 2D array
Mostrar comentarios más antiguos
Hi everyone.
First I'd like to thank you for taking the time to consider my problem.
I am currently building a novel microscope for imaging samples (cells, nano-particles, graphene, etc.) at sub-diffraction limited resolution. I won't go into too many details here so this is what you need to know. I have three columns of time dependent information:
1) Px(t) = A pointer to the x-coordinate of the image (ranging from 1 to 2048) [float]
2) Py(t) = A pointer to the y-coordinate of the image (ranging from 1 to 2048) [float]
3) I(t) = The measured intensity [float]
The objective here it to produce a 2D gaussian centred around (Px,Py) with intensity I for each point in time. Here is what I have written so far:
% Two pixel arrays and one intensity array
Px_t = [x1, x2, ..., xn];
Py_t = [y1, y2, ..., yn];
I_t = [I1, I2, ..., In];
% Define the span of the gaussian in x & y
x = linspace(1,2048,2048);
y = linspace(1,2048,2048);
% Let stdev = 1 for simplicity
sgma = 1;
% Initialize the image space
image = zeros(2048);
% Loop through time data
for t = 1:n
x0 = Px_t(t);
y0 = Py_t(t);
I = I_t(t)
% Generate new gaussian spread around x0 & y0
gx = exp(-(x-x0).^2/(2*sgma^2));
gy = exp(-(y-y0).^2/(2*sgma^2));
gxy = gx'*gy;
% Add the intensity scaled gaussian to the image array
image = image + I*gxy;
end
My question is if there is any way to perform this operation in parallel on the GPU? It is impossible to store n 2048x2048 arrays in memory and add them up after so I've resorted to this iterative approach.
All the best,
- Luke
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre GPU Computing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!