{ "info": { "author": "Akseli Palen", "author_email": "akseli.palen@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Human Machine Interfaces", "Topic :: Scientific/Engineering :: Image Recognition", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "======================\r\nnudged\\ :sup:`0.3.1`\r\n======================\r\n\r\nA Python lib to estimate scale, rotation, and translation between two sets of 2D points. Applicable for example in cases where one wants to move objects by multiple fingers or where a large number of points from an eye tracker device are wanted to be corrected based on a few calibration points. In general, you can apply nudged in any situation where you want to move a number of points based on a few sample points.\r\n\r\n.. image:: https://raw.githubusercontent.com/axelpale/nudged-py/master/doc/nudged-logo.png\r\n :alt: Example transformation\r\n :height: 353px\r\n :width: 300px\r\n\r\nMathematically speaking, nudged is an optimal least squares estimator for `affine transformation matrices\r\n`_ with uniform scaling, rotation, and translation and without reflection or shearing. The estimation has time complexity of O(*n*) that consists of *6n+22* multiplications and *11n+19* additions, where *n* is the cardinality (size) of the point sets. In other words, nudged solves an affine 2D to 2D point set registration problem in linear time.\r\n\r\nAvailable also `in JavaScript\r\n`_.\r\n\r\n\r\n\r\nInstall\r\n=======\r\n\r\n``$ pip install nudged``\r\n\r\n\r\n\r\nUsage\r\n=====\r\n\r\nYou have lists of points for the **domain** and **range** of the tranformation function to be estimated::\r\n\r\n dom = [[0,0], [2,0], [ 1,2]]\r\n ran = [[1,1], [1,3], [-1,2]]\r\n\r\nCompute optimal tranformation based on the points::\r\n\r\n trans = nudged.estimate(dom, ran);\r\n\r\nApply the transformation to other points::\r\n\r\n trans.transform([2,2])\r\n # [-1,3]\r\n\r\nTo explore the estimated transformation, you can::\r\n\r\n trans.get_matrix()\r\n # [[0,-1, 1],\r\n # [1, 0, 1],\r\n # [0, 0, 1]]\r\n\r\n trans.get_rotation()\r\n # 1.5707... = \u03c0 / 2 (radians)\r\n\r\n trans.get_scale()\r\n # 1.0\r\n\r\n trans.get_translation()\r\n # [1, 1]\r\n\r\n\r\n\r\nAPI\r\n===\r\n\r\n\r\nnudged.estimate(domain, range)\r\n------------------------------------------\r\n\r\n**Parameters**\r\n\r\n- *domain*: list of [x,y] points\r\n- *range*: list of [x,y] points\r\n\r\nThe *domain* and *range* should have equal length. Different lengths are allowed but additional points in the longer list are ignored.\r\n\r\n**Return** a new *nudged.Transform(...)* instance.\r\n\r\n\r\nnudged.estimate_error(transform, domain, range)\r\n-----------------------------------------------\r\n\r\nCompute mean squared distance between the point pairs of the domain after the given transformation and the range. If the transform was estimated with the given domain and range, then the result is the mean squared error (MSE) of the estimation.\r\n\r\n**Parameters**\r\n\r\n- *transform*: a *nudged.Transform* instance\r\n- *domain*: list of [x,y] points\r\n- *range*: list of [x,y] points\r\n\r\n**Return** a float, the mean squared distance between the range and transformed domain point pairs.\r\n\r\n**Usage example**::\r\n\r\n dom = [[0, 0], [1, 1], [2, 2]]\r\n ran = [[0,-1], [1, 2], [2,-1]]\r\n t = nudged.estimate(dom, ran)\r\n mse = nudged.estimate_error(t, dom, ran)\r\n # mse == 2.0\r\n\r\n\r\nnudged.version\r\n--------------\r\n\r\nContains the module version string equal to the version in *setup.py*.\r\n\r\n\r\nnudged.Transform(s, r, tx, ty)\r\n------------------------------\r\n\r\nAn instance returned by the *nudged.estimate(...)*.\r\n\r\nIn addition to the methods below, it has attributes *s*, *r*, *tx*, *ty* that define the `augmented transformation matrix\r\n`_::\r\n\r\n |s -r tx|\r\n |r s ty|\r\n |0 0 1|\r\n\r\nnudged.Transform#transform(points)\r\n..................................\r\n\r\n**Return** an list of transformed points or single point if only a point was given. For example::\r\n\r\n trans.transform([1,1]) # [2,2]\r\n trans.transform([[1,1]]) # [[2,2]]\r\n trans.transform([[1,1], [2,3]]) # [[2,2], [3,4]]\r\n\r\nnudged.Transform#get_matrix()\r\n.............................\r\n\r\n**Return** an 3x3 augmented transformation matrix in the following list format::\r\n\r\n [[s,-r, tx],\r\n [r, s, ty],\r\n [0, 0, 1]]\r\n\r\nnudged.Transform#get_rotation()\r\n...............................\r\n\r\n**Return** rotation in radians.\r\n\r\nnudged.Transform#get_scale()\r\n............................\r\n\r\n**Return** scaling multiplier, e.g. ``0.333`` for a threefold shrink.\r\n\r\nnudged.Transform#get_translation()\r\n..................................\r\n\r\n**Return** ``[tx, ty]`` where ``tx`` and ``ty`` denotes movement along x-axis and y-axis accordingly.\r\n\r\n\r\n\r\nFor developers\r\n==============\r\n\r\nFollow `instructions to install pyenv`\r\n`_ and then either run quick tests::\r\n\r\n $ python2.7 setup.py test\r\n\r\nor comprehensive tests for multiple Python versions in ``tox.ini``::\r\n\r\n $ eval \"$(pyenv init -)\"\r\n $ pyenv rehash\r\n $ tox\r\n\r\n\r\n\r\nVersioning\r\n==========\r\n\r\n`Semantic Versioning 2.0.0\r\n`_\r\n\r\n\r\n\r\nLicense\r\n=======\r\n\r\n`MIT License\r\n`_", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/axelpale/nudged-py", "keywords": "transformation calibration multitouch affine estimation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "nudged", "package_url": "https://pypi.org/project/nudged/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/nudged/", "project_urls": { "Homepage": "https://github.com/axelpale/nudged-py" }, "release_url": "https://pypi.org/project/nudged/0.3.1/", "requires_dist": null, "requires_python": null, "summary": "Estimate scale, rotation, and translation between two sets of 2D points e.g. for multi-touch gestures or calibration", "version": "0.3.1" }, "last_serial": 1978544, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "e3f770609f8b2d6049661412f2463725", "sha256": "a681fde12c306be66ebc32a12dcc57c13f9dc71a359b93b2209b1f5babec79a3" }, "downloads": -1, "filename": "nudged-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e3f770609f8b2d6049661412f2463725", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7386, "upload_time": "2015-10-20T20:46:58", "url": "https://files.pythonhosted.org/packages/8f/ea/8a89e5d29d294ff3b194791566b9865ab833671f63dd9492f29162467bf7/nudged-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "133fe0af771590c5e39586b9966278f2", "sha256": "09a42b62276bb7e22945a39a186051ce34a872c3d31fbf21d8f3ece47bf4cf8b" }, "downloads": -1, "filename": "nudged-0.2.0.tar.gz", "has_sig": true, "md5_digest": "133fe0af771590c5e39586b9966278f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5457, "upload_time": "2015-10-20T20:47:03", "url": "https://files.pythonhosted.org/packages/4a/6c/4f9052d31975dd99f66ca4d1bb2b29e24bbe128bfc0481bfd8eea190386e/nudged-0.2.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "1a1f80b144baab0177b132a37f5eb1cd", "sha256": "9029a7b8c27e3e5af9d7e12f5f55b51b5d51799a72aee3e53408ce68e607ec63" }, "downloads": -1, "filename": "nudged-0.3.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "1a1f80b144baab0177b132a37f5eb1cd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8011, "upload_time": "2016-02-26T18:11:26", "url": "https://files.pythonhosted.org/packages/5a/73/1ac27893feda9773ed1c2d26521d0d5e67fe30df7acad81ef0142945297a/nudged-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f5feaea0927da774cc459ae17c2f065", "sha256": "7f576dcaab3c559171185de067c45469846a3c6cd00792e85bb4b603bb72bec5" }, "downloads": -1, "filename": "nudged-0.3.1.tar.gz", "has_sig": true, "md5_digest": "6f5feaea0927da774cc459ae17c2f065", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5832, "upload_time": "2016-02-26T18:11:33", "url": "https://files.pythonhosted.org/packages/77/f1/0aab175d8666c72627235dadd3955683c96aea954e8d2bdbeb3030cec077/nudged-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1a1f80b144baab0177b132a37f5eb1cd", "sha256": "9029a7b8c27e3e5af9d7e12f5f55b51b5d51799a72aee3e53408ce68e607ec63" }, "downloads": -1, "filename": "nudged-0.3.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "1a1f80b144baab0177b132a37f5eb1cd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8011, "upload_time": "2016-02-26T18:11:26", "url": "https://files.pythonhosted.org/packages/5a/73/1ac27893feda9773ed1c2d26521d0d5e67fe30df7acad81ef0142945297a/nudged-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f5feaea0927da774cc459ae17c2f065", "sha256": "7f576dcaab3c559171185de067c45469846a3c6cd00792e85bb4b603bb72bec5" }, "downloads": -1, "filename": "nudged-0.3.1.tar.gz", "has_sig": true, "md5_digest": "6f5feaea0927da774cc459ae17c2f065", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5832, "upload_time": "2016-02-26T18:11:33", "url": "https://files.pythonhosted.org/packages/77/f1/0aab175d8666c72627235dadd3955683c96aea954e8d2bdbeb3030cec077/nudged-0.3.1.tar.gz" } ] }