camlab


Namecamlab JSON
Version 0.1.6.0 PyPI version JSON
download
home_pageNone
SummaryA Python library for camera-related utilities and lab tools.
upload_time2025-10-22 08:23:12
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseCopyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords camera computer-vision lab toolkit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CamLab
## play with camera pose

```sh
pip install camlab
```

<p float="center">
  <img src="assets/camera_system_calibration.gif" width="78%" />
</p>

project a world-coordinate point to screen coordniate:

```python
import numpy as np
from camlab import CameraObj


cam = CameraObj()

# init intrinsics
focal = 1111.1
w = 800
h = 800
cam.manual_init(focal, w, h)

# init extrinsics
extri = np.array(
        [[-9.9990e-01,  4.1922e-03, -1.3346e-02, -5.3798e-02],
        [-1.3989e-02, -2.9966e-01,  9.5394e-01,  3.8455e+00],
        [-4.6566e-10,  9.5404e-01,  2.9969e-01,  1.2081e+00],
        [0.0, 0.0, 0.0, 1.0]])
cam.load_extrinsic(extri)

# coordinates transformation
p_in_world = [0, 0, 0]
p_in_screen = cam.world2screen(p_in_world, to_int=True)
print(p_in_screen)
# [400, 400]

```

make a ray from a screen point:

```python
import numpy as np
from camlab import CameraObj

intri = [[1111.0, 0.0, 400.0],
         [0.0, 1111.0, 400.0],
         [0.0, 0.0, 1.0]]
extri = np.array(
        [[-9.9990e-01,  4.1922e-03, -1.3346e-02, -5.3798e-02],
        [-1.3989e-02, -2.9966e-01,  9.5394e-01,  3.8455e+00],
        [-4.6566e-10,  9.5404e-01,  2.9969e-01,  1.2081e+00],
        [0.0, 0.0, 0.0, 1.0]])

cam_obj = CameraObj(intri)
cam_obj.load_extrinsic(extri)

p = (400, 400)  # screen point
rayo, rayd = cam_obj.make_ray(p)
print(rayo, rayd)
# ray origin and ray direction
# (rayd - rayo) represents a point at the ray.
p_ = cam_obj.world2screen(rayd - rayo, to_int=True)
# reproject the ray point to screen
print(p_)
# (400, 400)

``` 


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "camlab",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Liwei Liao <your_email@example.com>",
    "keywords": "camera, computer-vision, lab, toolkit",
    "author": null,
    "author_email": "Liwei Liao <your_email@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/f5/ee/7ec3e2f4e1fd28ac82f16078e26f769de8574d44b69190b24adce866bc8c/camlab-0.1.6.0.tar.gz",
    "platform": null,
    "description": "# CamLab\n## play with camera pose\n\n```sh\npip install camlab\n```\n\n<p float=\"center\">\n  <img src=\"assets/camera_system_calibration.gif\" width=\"78%\" />\n</p>\n\nproject a world-coordinate point to screen coordniate:\n\n```python\nimport numpy as np\nfrom camlab import CameraObj\n\n\ncam = CameraObj()\n\n# init intrinsics\nfocal = 1111.1\nw = 800\nh = 800\ncam.manual_init(focal, w, h)\n\n# init extrinsics\nextri = np.array(\n        [[-9.9990e-01,  4.1922e-03, -1.3346e-02, -5.3798e-02],\n        [-1.3989e-02, -2.9966e-01,  9.5394e-01,  3.8455e+00],\n        [-4.6566e-10,  9.5404e-01,  2.9969e-01,  1.2081e+00],\n        [0.0, 0.0, 0.0, 1.0]])\ncam.load_extrinsic(extri)\n\n# coordinates transformation\np_in_world = [0, 0, 0]\np_in_screen = cam.world2screen(p_in_world, to_int=True)\nprint(p_in_screen)\n# [400, 400]\n\n```\n\nmake a ray from a screen point:\n\n```python\nimport numpy as np\nfrom camlab import CameraObj\n\nintri = [[1111.0, 0.0, 400.0],\n         [0.0, 1111.0, 400.0],\n         [0.0, 0.0, 1.0]]\nextri = np.array(\n        [[-9.9990e-01,  4.1922e-03, -1.3346e-02, -5.3798e-02],\n        [-1.3989e-02, -2.9966e-01,  9.5394e-01,  3.8455e+00],\n        [-4.6566e-10,  9.5404e-01,  2.9969e-01,  1.2081e+00],\n        [0.0, 0.0, 0.0, 1.0]])\n\ncam_obj = CameraObj(intri)\ncam_obj.load_extrinsic(extri)\n\np = (400, 400)  # screen point\nrayo, rayd = cam_obj.make_ray(p)\nprint(rayo, rayd)\n# ray origin and ray direction\n# (rayd - rayo) represents a point at the ray.\np_ = cam_obj.world2screen(rayd - rayo, to_int=True)\n# reproject the ray point to screen\nprint(p_)\n# (400, 400)\n\n``` \n\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2018 The Python Packaging Authority\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        \n        ",
    "summary": "A Python library for camera-related utilities and lab tools.",
    "version": "0.1.6.0",
    "project_urls": {
        "Homepage": "https://github.com/leviome/camlab",
        "Issues": "https://github.com/leviome/camlab/issues",
        "Repository": "https://github.com/leviome/camlab"
    },
    "split_keywords": [
        "camera",
        " computer-vision",
        " lab",
        " toolkit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d215e62430e7f5e04079bfa4f867a72df888b35808f784b268bee8d1ec3c779d",
                "md5": "debf7ee28a2a179d5ecb87c40aa3f172",
                "sha256": "2206074e7191f3ea4e2ab674e8c85442919642095a7409b1112ec4dcdebdbd71"
            },
            "downloads": -1,
            "filename": "camlab-0.1.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "debf7ee28a2a179d5ecb87c40aa3f172",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9010,
            "upload_time": "2025-10-22T08:23:10",
            "upload_time_iso_8601": "2025-10-22T08:23:10.029476Z",
            "url": "https://files.pythonhosted.org/packages/d2/15/e62430e7f5e04079bfa4f867a72df888b35808f784b268bee8d1ec3c779d/camlab-0.1.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f5ee7ec3e2f4e1fd28ac82f16078e26f769de8574d44b69190b24adce866bc8c",
                "md5": "0961b8afbe4929a698e54c8459fcd37a",
                "sha256": "8d11c7bb72bd30b041be827da26eb2545e050db02a9084a3876ab501b4f5fc6e"
            },
            "downloads": -1,
            "filename": "camlab-0.1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0961b8afbe4929a698e54c8459fcd37a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7839,
            "upload_time": "2025-10-22T08:23:12",
            "upload_time_iso_8601": "2025-10-22T08:23:12.516011Z",
            "url": "https://files.pythonhosted.org/packages/f5/ee/7ec3e2f4e1fd28ac82f16078e26f769de8574d44b69190b24adce866bc8c/camlab-0.1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-22 08:23:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "leviome",
    "github_project": "camlab",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "camlab"
}
        
Elapsed time: 3.14891s