# Track the location of of dot from noisy image

https://imgur.com/a/SnTYESG (subtraction between the image)

https://imgur.com/a/ZdOS5wf (orignal image)

From the original image, since my CCD camera is bad, I cannot really see anything. However, if I subtract between two data,backgound noise are cancelled, so I can see the single photon measurement Since I am subtracting the image, sometimes my dot is positive(white) and negative (black).

Is it possible to track this blur point, and get the position information or reduce the noise to make the region brighter? Since the noise is too high, I am having a hard time locating or filtering the noise.

any suggestions?

You will probably want to record a separate background image where you are certain that no photons are present, which you can subtract from all other images so as not to overlap several measurements in one picture.

Let's take one of your subtracted images

SetDirectory[NotebookDirectory[]];
image = Import["im5Nx9y.png"] There is noise as well as signal on this image. The noise is higher frequency than signal, which is good. To smooth out the noise, we can blur this image to some extent, but the pixel radius of the blur should be small enough as to not blur out the higher wavelength signal. After a bit of trial and error it seems that blurring with a radius of 25 pixels is most convenient:

blurred = Blur[image, 25] Finally, we can take the mean and the standard deviation of all pixel values. Then we apply a transformation that sets all pixels in the range mean-5*stddev < pixel < mean+5*stddev to be equal to the mean, so that any features that are not dominant enough are completely flattened out:

data = ImageData[blurred];
mean = Mean[data // Flatten];
stddev = StandardDeviation[data // Flatten];
newdata =
Table[
data[[i, j]] /. pixel_ :> If[(mean - 5 stddev < pixel < mean + 5 stddev), mean, pixel]
, {i, 1, Length[data]}, {j, 1, Length[Transpose[data]]}];
newimage = Image[newdata] This keeps only very prominent features, as desired.