LogPolarSolver¶
-
class
imgreg.models.logpolar.solver.
LogPolarSolver
(ref_img: Optional[numpy.ndarray] = None, mod_img: Optional[numpy.ndarray] = None)[source]¶ Implements an image registration model based on the log-polar transform.
The model tries to reconstruct the difference of scale, rotation and translation between two images.
- Parameters
- ref_imgnumpy.ndarray
The original input image (one color channel only).
- mod_imgnumpy.ndarray
The modified input image (one color channel only).
Notes
Build based on the approach of the example code 1 from scikit-image. Alternative implementations using feature based detection algorithms are shown in 2.
The model implements the following dependency graph to construct it’s Parameters.
The Parameters are documented in params.
References
Examples
We can visualize the internal ImageParameters of the model as follows:
import numpy as np import imgreg.data as data from imgreg.models.logpolar import LogPolarSolver ref_img = np.array(data.ref_img()) mod_img = np.array(data.mod_img()) # Create the model: lps = LogPolarSolver(ref_img, mod_img) # The ImageParameters of the model have matplotlib support via the display function: lps.display([lps.REF_IMG, lps.MOD_IMG]) lps.display([lps.GAUSS_DIFF_REF_IMG, lps.GAUSS_DIFF_MOD_IMG]) lps.display([lps.FOURIER_REF_IMG, lps.FOURIER_MOD_IMG]) lps.display([lps.WARPED_FOURIER_MOD_IMG, lps.WARPED_FOURIER_REF_IMG]) lps.display([lps.RECOVERED_ROT_SCALE_IMG, lps.REF_IMG]) lps.display([lps.RECOVERED_ROT_SCALE_TR_IMG, lps.REF_IMG])
If we simply want to create a model and access the recovered values we first setup a model:
>>> import numpy as np >>> import imgreg.data as data >>> from imgreg.models.logpolar import LogPolarSolver, LogPolParams >>> ref_img = np.array(data.ref_img()) >>> mod_img = np.array(data.mod_img()) >>> lps = LogPolarSolver(ref_img, mod_img)
Now the parameters of the model can now be accessed as follows:
>>> lps.RECOVERED_ROTATION.value array([-13.06730769, 0.11259774])
>>> lps.RECOVERED_TRANSLATION.value array([-17.98318062, 31.037803 , 0.42407651])
Methods
__init__
([ref_img, mod_img])Initialize self.
display
(param_list[, title])Fancy plot functionality for registered ImageParameters.
dot_graph
([node_args_func])Return a dot graph representation of the solver model.