How to randomly propagate 100 random targets with random headings (uniformly sampled over [0, 2π])

2 views (last 30 days)
So I contructed a 2048x1024 pixel background image with the signal normally distribution at mean 0 and standard deviation 5 (arbitray units) with 100 randomly placed targets, which needs to be at the subpixel level. Here is the full description of what I need to do:
1. Construct a 2048 x 1024 pixel background image with the signal normally distributed at mean 0 and standard deviation 5 (arbitrary units).
2.Insert 100 randomly placed targets across the image at a subpixel level with random headings (uniformly sampled over [0,2π]) and speeds randomly sampled from a uniform distribution ranging over [0.1 pixels/s, 3 pixels/s]. The targets can have a nominal intensity of 20 (arbitrary units) and should be considered point sources as they are very far away from the viewing sensor.
3.Propagate the targets’ trajectory forward in time and assume an integration time period between sequential images of 0.1s; you can incorporate higher frequency time intervals if you wish to include smearing of the target within an integration period. Assume 2D geometries for everything.
4.The background noise should be temporally uncorrelated and regenerated for each integration period.
5.Assume a Gaussian optical blur with a standard deviation of 0.75 pixels that is applied to the entire scene, or an equivalent sombrero/Bessel MTF.
6.Collect 100 images (corresponding to 10 seconds) worth of images, and save them as a movie.
Here is the code I have so far:
clear all;clc
%1. Pixel Background Image
x=2048;
y=1024;
P = round(normrnd(0,5,y,x));
figure (1)
imagesc(P) %Noise signal image
hold on
colorbar
m=mean(P);
m=mean(m);
sd=std(P);
sd=mean(sd);
%2. 100 Random Targets
T=zeros(y,x);
for i=1:100
Tx(i)=round(rand(1)*x);
Ty(i)=round(rand(1)*y);
T(Ty(i),Tx(i))=20;
P(Ty(i),Tx(i))=20;
end
sum(T(:)==20) %sanity check
figure(2)
imagesc(T) %Target image
hold on
colorbar
figure(3)
imagesc(P) %Background image with targets
hold on
colorbar
v=linspace(0.1,3); %velocity - pixels/s
dt=0.1;
So the targets are just at pixel level and not subpixel level.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 6 Jan 2022
Yes. The image is constructed with pixel-resolution, that is kind of the definition of a pixel-based image sensor. You model the location of your objects in the real-world with higher precision. As a first-stab you might simply use the rounded position of your objects and then convolve them with the optical bluring PSF. However, you should fix a couple of points in your script:
1, add the positions of your particles, then convolve/blur to account for the optics, then add the noise-contribution to that one.
2, You should first generate your 100 particle positions (x, y) at time t0, and their corresponding velocities (vx, vy), then calculate their positions for each time during 10 s. It is not stated that the particles will be colliding nor accelerated during this time intervall so this should be a simple calculation.
Once you've done this you could consider calculating the blured image-contribution from the particles on a sub-pixeled image-region and then average those intensities to the full-pixel image - instead of taking the rounded-to-nearest-integer position.
(Also good hint: sketch/doodle these steps on paper to illustrate the procedure graphically, that helps me wrapping my head around image-processing stuff).
HTH

Community Treasure Hunt

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

Start Hunting!