No project description provided
Project description
RLSMorph
Here Should Be a Logo
Installation
-
From pypi
pip install rlsmorph
-
Browse to your destination and download the repository locally:
git clone https://github.com/RakitaLabSoftware/rlsmorph rlsmorph cd rlsmorp
-
Create a virtual environment. For example:
- python
python -m venv .venv source .venv/bin/activate
- conda
conda create -n rlsmorph python=3.11 conda activate rlsmorh
Note: If you are using an existing virtual environment - skip this step. But this is strongly recommended to work in some virtual environment
- Install:
- General installation:
pip install -e . - For developers also install:
pip install -e "[.dev]"
- General installation:
Structure
Alignment main computational steps:
- Load source and target in a
np.ndarray.- Output: a numpy 2D matrix
Preprocessing#TODOFeaturePointDetectorfinds the keypoints(coordinates and point size) and based on them exctracts descriptors(features) for each keypoint in image.- Output: a list of (selection-reagion (point and area), features)
Matchermatch the descriptors based on their similarity accoring to chosen algorithm.- Output: a sorted list of keypoints based on goodness of fit.
Warperis algorithm that compute the best transformation matrix(M) between provided target(t) and source(s) keypoints (s*M=t) and then apply it to source image. In other words it tries to decrease distance between the matched(sorted) keypoints between target and source given predetermined constraints for warping. For example a constain be that an image will only be rotated or freely distorted.- Output: transformation matrix and warped source (transformed source image). Note that based on chosen algorithm of warper one may require different transformation(it could be 2d matrix or 3d matrix if we choose homography based algorithm).
from_config method:
The way we load the object type (for example: data, data type, functions (for matching, warping, etc.)), is via a config object (json, yml, pickle). Therefore we need a from_config method to setup the object that are going to be used in the workflow above.
Hooks:
"Hook" is an operation that can be acted on the outputs of each object. It is often defined after a core operation occurs, without interfering the flow, but allowing a side operation take place, such as visualization, caching etc. Implementation-wise: an external function will always operate on a hook object.
Strategies for:
Preprocessing:
- Apply convolution matrix to increase feature contrast. (elaborate)
Finding Feature Points
A Feature Point is described by the pair of Keypoint and corresponding Descriptor. Keypoint is basically coordinates (x,y), and region around the selected coordinate (area of ROI). Descriptor is numeric representation of the image content(texture, gradient, change in contrast etc.) or in other way something that describes a property of ROI in an image.
To set keypoints we can use several approaches:
- Manual Selection:
- a user manually selects keypoints on both src and trg images by clicking on the images at locations she/he thinks are similar. This way we assure a possible ground truth, but also prone to human error.
- Classical Computer Vision (CCV) Algorithm:
- automatically detects keypoints based on descriptors that are present in the entire region of selection, where the keypoint selection is based on hand crafted(non machine learning) algorithm (ORB, SIFT, etc.) quantity of interest (QoI).
- Machine Learning Computer Vision (MLCV) Algorithm:
- Same as CCV, but the QoI is computed via a ML algorithm. Example will be "Segment Everything" (SAM).
Matching Keypoints
Matches refer to the correspondence between descriptors of different images. Matching is the process of finding pairs of descriptors that describe the same point or region in the scene.
In SciMorph there is two matching algorithms:
- NaiveMatcher:
- Basically just returns list of
cv2.DMatchwithout changing it order with fixed distance equals 0.5
- Basically just returns list of
- FeatureMatcher:
- Matches features points based on similarity of their descriptors.
Warping
After we found out how feature points of source image matches with feature points target we can make compute transformation matrix (which is basically just change-of-basis/transition matrix) and then apply this transformation to whole source image. We could also set restriction for type of transformation matrix (dimentionality)
Transformation
- Prespective
- Affine
- Rotation
- Translation
TODO:
- Organize CCV - make a version with it
- Explore MLCV - SAM, ect.
- Apply preprocessing post image load and prior to keypoint selection
- Output in warper both transformation_matrix, trasformation_method, transformed_source
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rlsmorph-0.1.0.tar.gz.
File metadata
- Download URL: rlsmorph-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21ce652432f315737fdcba3ad496225872bf9f07b4adf5fa648ce5f35a22ee27
|
|
| MD5 |
f2becc5bea871f18da06d593582e2561
|
|
| BLAKE2b-256 |
75a206d1148ea6e327fc132da171805927b20c5f806535279544084e984ac41e
|
File details
Details for the file rlsmorph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rlsmorph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
908b77b5262aac8e37afdc48cc5ac37a32713fe61f8ccc042f7df7429a676fdd
|
|
| MD5 |
b2dfd57fc0205ca3acfc9e4fe4b5d36a
|
|
| BLAKE2b-256 |
1ffbed8b295272776b36028f1d8e2858a041919fa3c6c444fe6ac0eb5dfeca13
|