Catalog PyPI
PACKAGE EXPLORERView in registry

affine6p-cstest

PyPI

To calculate affine transformation parameters with six free parameters.

affinecalculateparameterssixtransformation
Versions collected1
Direct dependencies0From release 0.8.1
Last observed20 Oct, 21:04 UTC

README

Version 0.8.1 documentation
==========
affine6p
==========

The Python lib to estimate affine transformation parameters between two sets of 2D points.::

    | x' |   | a  b  p | | x |
    | y' | = | c  d  q | | y |
    | 1  |   | 0  0  1 | | 1 |

.. image:: https://gitlab.com/yoshimoto/affine6p-py/raw/master/affine6p.png
   :alt: Example transformation
   :height: 353px
   :width: 300px

When the sets are more than three points, the lib estimate parameters with the least squares method.

In making this lib, I used a lot of ideas in nudged lib. Ref: https://github.com/axelpale/nudged-py

Install
-----------
Use pip::

    pip install affine6p

Usage
-----------

You have lists of points for the **original** and **converted** of the transformation function to be estimated::

    import affine6p
    origin = [[0,0], [1,0], [0,1], [1,1]]
    convert = [[0,0], [1,0], [0,1], [1,1.1]]
    trans = affine6p.estimate(origin, convert)
    trans.get_matrix()
    # [[1.0, 0.0, 0.0],
    # [0.050000000000000044, 1.05, -0.02499999999999991],
    # [0, 0, 1]]
    affine6p.estimate_error(trans, origin, convert)
    # 0.025000000000000022

When the number of origin is **1**, assume the following relationship::

    a = d = 1 and b = c = 0

When the number of origin is **2**, assume the following relationship as described in *estimate_helmert*.::

    a = d and b = -c 

You can access **Transform class members**.::

    trans.a() # params[0]
    trans.b() # params[1]
    trans.c() # params[2]
    trans.d() # params[3]
    trans.p() # params[4]
    trans.q() # params[5]
    trans.get_matrix() # [[a, b, p], [c, d, q], [0, 0, 1]]
    trans.get_rotation_x() # math.atan2(-b, a)
    trans.get_rotation_y() # math.atan2(c, d)
    trans.get_scale_x() # sqrt(a*a + b*b)
    trans.get_scale_y() # sqrt(c*c + d*d)
    trans.get_scale() # sqrt((scale_x*scale_x+scale_y*scale_y)*0.5)
    trans.get_translation() # [p, q]
    trans.params # [a, b, c, d, p, q]

You can apply **transform** or **rotate** to 2D point or points. The rotate means *p = q = 0*.::

    trans.transform([0, 0])
    trans.transform([[0, 0], [1, 1]])
    point = [0, 0]
    trans.transform_inv(point)
    trans.rotate(point)
    trans.rotate_inv(point)

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.8.121 Jul 20180

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

ACCESSIBLE
yoshimoto/affine6p-py

Shared repository data · GitLab

License detected in repository
Other
License branch / ref
master
Contributor identities
1 · complete API traversal
License file
Contributors · showing 1 of 1 collected
ContributorContributions
Masahiro Yoshimoto39

Default-branch author identities; GitLab commit counts exclude merge commits.

Public sponsor counts have not been collected. These signals belong to the repository owner.

Downloads & popularity

1identities
Gauge · observed snapshots23 Oct 2026
10.50
2026-10-20: 1 · observed 2026-10-20T21:31:35.7381940Z2026-10-21: 1 · observed 2026-10-21T21:32:10.5945172Z2026-10-22: 1 · observed 2026-10-22T21:33:04.5107936Z2026-10-23: 1 · observed 2026-10-23T21:34:34.3078922Z
20 Oct23 Oct

gitlab · 4 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-2312026-10-23T21:34:34.3078922Z
2026-10-2212026-10-22T21:33:04.5107936Z
2026-10-2112026-10-21T21:32:10.5945172Z
2026-10-2012026-10-20T21:31:35.7381940Z

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:04 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:70a7dfd7cd9a17eeb971323682162d7741ee077e284d5f0bdb5e1a930c08bfb7