1
$\begingroup$

I have the following problem. I have a speckle pattern (of light) like on the image below (left). I have to locate as precisely as possible the centers of all speckles.

That would not be a problem if those speckles would have some constant, known shape, e.g. Gaussians.

But they are irregular and I do not really know how to do this.

What I do now is:

  1. I look for the highest point in the image and Im registering coordinates of this point.
  2. I mask (NaN) the circular area near this point - more or less of the size of a typical speckle (image, 2nd subplot) and
  3. I'm searching for another highest point. If there are no NaNs in the circular ares of this point, I register its position also. And so on, hundreds of times.

But it is not working to well. Is there any standard method in signal analysis for localization of individual speckles in the speckle pattern?

Image:

  • Left - speckle pattern
  • 2nd - masked areas
  • 3rd - registered positions if the masks can overlap
  • 4rd - ... if they cannot.

enter image description here

$\endgroup$
4
  • $\begingroup$ Hi! So, what is "ground truth", how do you tell "content" from speckle at all? To me, the left picture looks like only speckles, which makes sense for a speckle pattern, but in the second picture, that pattern suddenly gets brighter. $\endgroup$ Dec 12, 2017 at 21:37
  • $\begingroup$ Also, what physical phenomenon leads to a speckle pattern like that? That might lead you to a mathematical model of the speckle shape and distribution! $\endgroup$ Dec 12, 2017 at 21:42
  • $\begingroup$ @Marcus, There are only speckles. In the secon picture the pattern got brighter, becouse brightest areas were removed. The mathematical model has a lot of random numbers, so this approach would be very difficult. The phenomena is optical parametric amplification. $\endgroup$
    – Aleksander
    Dec 12, 2017 at 21:50
  • $\begingroup$ Well, the problem is that the speckle remover that you want to have is just an estimator for a 2D stochastic process. So, I'd really not hesitate to post a question here that specifies that physical model and asks for a way to describe the resulting speckle pattern stochastically. I don't see a way around stochastic methods here. $\endgroup$ Dec 12, 2017 at 21:53

1 Answer 1

2
$\begingroup$

Essentially, isn't this just looking for local maxima in the image? Have a look at the following code. It dilates the image, i.e. putting each pixel the value of the maximum of its neighborhood. Then, it checks which pixels actaully were the maximum and marks them with a circle:

import skimage
import skimage.io
import skimage.morphology
import numpy as np
import skimage.draw
import scipy.ndimage

I = skimage.io.imread("Capture.PNG", as_grey=True)

selem = np.ones((9,9))
D = skimage.morphology.dilation(I, selem)
plt.figure(figsize=(12,12))

plt.subplot(221); plt.imshow(I); plt.title("Original image")
plt.subplot(222); plt.imshow(D); plt.title("dilated image")

maxima = I==D
plt.subplot(223); plt.imshow(maxima); plt.title("Detected Maxima regions")


labels, nlabels = scipy.ndimage.label(maxima)

plt.subplot(224); plt.imshow(labels)
print (nlabels)

C = scipy.ndimage.measurements.center_of_mass(maxima, labels, 1+np.arange(nlabels-1))
I2 = I.copy()
for x, y in C:
    rr, cc = skimage.draw.circle_perimeter(int(x), int(y), 5, shape=I2.shape)
    I2[rr,cc] = 1
plt.imshow(I2); plt.title("Center of mass of maxima"); plt.colorbar();

enter image description here

what is missing is e.g. a threshold to ignore small maxima.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.