Skip to main content

No project description provided

Project description

RLSMorph

Here Should Be a Logo

Code Style: Black build

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]"

Structure

Alignment main computational steps:

  1. Load source and target in a np.ndarray.
    • Output: a numpy 2D matrix
  2. Preprocessing #TODO
  3. FeaturePointDetector finds 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)
  4. Matcher match the descriptors based on their similarity accoring to chosen algorithm.
    • Output: a sorted list of keypoints based on goodness of fit.
  5. Warper is 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:

  1. 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:

  1. 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.
  2. 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).
  3. 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:

  1. NaiveMatcher:
    • Basically just returns list of cv2.DMatch without changing it order with fixed distance equals 0.5
  2. 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

  1. Prespective
  2. Affine
  3. Rotation
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rlsmorph-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rlsmorph-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

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

Hashes for rlsmorph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 21ce652432f315737fdcba3ad496225872bf9f07b4adf5fa648ce5f35a22ee27
MD5 f2becc5bea871f18da06d593582e2561
BLAKE2b-256 75a206d1148ea6e327fc132da171805927b20c5f806535279544084e984ac41e

See more details on using hashes here.

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

Hashes for rlsmorph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 908b77b5262aac8e37afdc48cc5ac37a32713fe61f8ccc042f7df7429a676fdd
MD5 b2dfd57fc0205ca3acfc9e4fe4b5d36a
BLAKE2b-256 1ffbed8b295272776b36028f1d8e2858a041919fa3c6c444fe6ac0eb5dfeca13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page