RadonSolver¶
-
class
imgreg.models.radon.solver.
RadonSolver
(ref_img: Optional[numpy.ndarray] = None, mod_img: Optional[numpy.ndarray] = None)[source]¶ Implements an image registration model based on the radon transform.
The model tries to reconstruct the difference of 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
The model implements the following dependency graph to construct it’s Parameters.
The Parameters are documented in params.
Examples
We can visualize the internal ImageParameters of the model as follows:
import numpy as np import imgreg.data as data from imgreg.models.radon import RadonSolver ref_img = np.array(data.ref_img()) mod_img = np.array(data.mod_img()) # Create the model: ras = RadonSolver(ref_img, mod_img) # The ImageParameters of the model have matplotlib support via the display function: ras.display([ras.REF_IMG, ras.MOD_IMG]) ras.display([ras.RECOVERED_ROT_IMG, ras.REF_IMG]) ras.display([ras.RECOVERED_ROT_TR_IMG, ras.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.radon import RadonSolver >>> ref_img = np.array(data.ref_img()) >>> mod_img = np.array(data.mod_img()) >>> ras = RadonSolver(ref_img, mod_img)
Now the parameters of the model can now be accessed as follows:
>>> ras.RECOVERED_ROTATION.value array([-11.35802469, 0.28284271])
>>> ras.RECOVERED_TRANSLATION.value array([-11.80822224, 25.77936941, 0.30466765])
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.