slmsuite.holography.analysis.blob_array_detect#
- blob_array_detect(img, size, orientation=None, orientation_check=True, dft_threshold=100, dft_padding=0, k=8, tol=0.1, plot=False)[source]#
Detect an array of spots and return the orientation as an affine transformation. Primarily used for calibration.
For a rectangular array of spots imaged in
img, find the variables \(\vec{M}\) and \(\vec{b}\) for the affine transformation\[\vec{y} = M \cdot \vec{x} + \vec{b}\]which converts spot indices \(\vec{x}\) into camera pixel indices \(\vec{y}\).
- Parameters:
img (numpy.ndarray) – The image in question.
size ((int, int) OR int) – The size of the rectangular array in number of spots
(Nx, Ny). If a singleintsize is given, then assume(N, N).orientation (dict or None) – Guess array orientation (same format as the returned) from previous known results. If
None(the default), orientation is estimated from looking for peaks in the Fourier transform of the image.orientation_check (bool) – If enabled, looks for two missing spots at one corner as a parity check on rotation. Used by
fourier_calibrate(). Seemake_rectangular_array().dft_threshold (float in [0, 255]) – Minimum value of peak in blob detect of the DFT of
imgwhenorientationisNone. Passed as keyword argument toblob_detect()with keywordminThreshold.dft_padding (int) – Increases the dimensions of the padded
imgbefore the DFT is taken whenorientationisNone. Dimensions are increased by a factor of2 ** dft_padding. Increasing this value increases the \(k\)-space resolution of the DFT, and can improve orientation detection.k (int) – Number of nearest neighbors to use for each point when lattice matching. Defaults to 8.
tol (float) – Difference in normalized displacement between reciprocal lattice points to be considered members of the same group when lattice fitting. Defaults to 10%.
plot (bool) – Whether or not to plot debug plots. Default is
False.
- Returns:
Orientation dictionary with the following keys, corresponding to the affine transformation:
"M":numpy.ndarray(2, 2)."b":numpy.ndarray(2, 1).
- Return type:
dict