slmsuite.holography.analysis.blob_array_detect
- blob_array_detect(img, size, orientation=None, orientation_check=True, dft_threshold=50, dft_padding=0, 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 singleint
size 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 img when orientation is None. Passed as kwarg to
blob_detect()
with name minThreshold.dft_padding (int) – Increases the dimensions of the padded img before the DFT is taken when orientation is None. Dimensions are increased by a factor of 2 ** dft_padding. Increasing this value increases the k-space resolution of the DFT, and can improve orientation detection.
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