Simple plugin for SIFT keypoint detection, and affine registration with RANSAC, based on scikit-image
Project description
skimage-sift-registration
Simple plugin for 2D keypoint detection, and affine registration with RANSAC.
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template. It uses the scikit-image SIFT keypoint detection routines to find distinctive image points and generate local descriptions of the image near them. Correspondences between the two images are then found by looking for pairs of keypoints, one in each of the two images, with closely matching descriptors.
For typical images, many of these correspondances will be wrong. To reduce these false correspondences, the plugin applies the RANSAC algorithm. This randomly selects a small subset of the matching pairs of keypoints, estimates the affine transformation between these keypoints, and then evaluates how many of the other pairs of keypoints also closely agree with this affine transformation ("inliers"). A large number of random samples are tested, and the transformation with the most inliers retained.
The plugin outputs two points layers, one for each image, containing all the corresponding SIFT keypoints betwee the two images, highlighting (and labelling) those that were retained as inliers after RANSAC matching. It also uses the estimated affine transformation between the two images to deform the "moving" image layer onto the "fixed" image layer.
This approach is an attempt to provide similar functionality to the Stephan Saalfeld's Fiji "Extract SIFT Correspondences" plugin extract, and more-or-less just provides a napari interface to the existing routines in scikit-image. There are great examples in the scikit-image documentation (e.g. SIFT-example and RANSAC-example) that can be used if you would like to use these routines in your own analysis scripts.
Installation
You can install napari-sift-registration
via pip:
pip install napari-sift-registration
To install the latest development version :
pip install git+https://github.com/jfozard/napari-sift-registration.git
Usage
Basic usage
- Load two 2D single channel images in Napari.
- Select the menu item Plugins >
- Select these two images as the "Moving image layer" and the "Fixed image layer". The moving image will be deformed by the transformation to look like the fixed image.
- The remaining parameters are the default settings from scikit-image; try these default values first.
Advanced usage
The parameter values for SIFT feature detection, keypoint matching and RANSAC are accessible from the plugin gui. For further information about their use, see the appropriate scikit-image documentation:
Upsampling before feature detection, maximum number of octaves, maximum number of scales in every octave, blur level of seed image, feature descriptor size, feature descriptor orientation bins: see scikit-image-SIFT.
Closest/next closest ratio: see scikit-image-match_descriptors
Minimum number of points sampled for each RANSAC model, distance for points to be inliers in RANSAC model, maximum number of trials in RANSAC model: see scikit-image-RANSAC
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the BSD-3 license, "napari-sift-registration" is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for napari-sift-registration-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab0063a92cf6c18bf68ed42eeb7d6fb84333978101123ff4c01d1d12f92c420d |
|
MD5 | 47b666c585ef1495aa22db121bddbeca |
|
BLAKE2b-256 | 5169271fb967230fafbb489b1b9dc620570f8bf88a3f06173fffca70911a87d6 |
Hashes for napari_sift_registration-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f76d2bb0a51dff36b90cc062c956aa86c6b6fcf4bddd8c37bdddc68df5eac13 |
|
MD5 | e3ea6cb4780106aef76ca0de8e3bca96 |
|
BLAKE2b-256 | dd2e3c329380ef629b2094bd4832d820b50599519e44822a6db641990054d61e |