{"id":15695914,"url":"https://github.com/momsfriendlyrobotcompany/opencv_camera","last_synced_at":"2025-05-08T22:14:07.736Z","repository":{"id":65536905,"uuid":"276898460","full_name":"MomsFriendlyRobotCompany/opencv_camera","owner":"MomsFriendlyRobotCompany","description":"OpenCV camera library","archived":false,"fork":false,"pushed_at":"2024-12-08T14:57:19.000Z","size":311485,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T22:14:00.054Z","etag":null,"topics":["apriltags","camera-calibration","opencv-python","python3"],"latest_commit_sha":null,"homepage":"https://nbviewer.org/github/MomsFriendlyRobotCompany/opencv_camera/tree/master/docs/jupyter/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MomsFriendlyRobotCompany.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-03T12:47:45.000Z","updated_at":"2025-04-18T06:58:22.000Z","dependencies_parsed_at":"2023-02-10T00:00:27.172Z","dependency_job_id":null,"html_url":"https://github.com/MomsFriendlyRobotCompany/opencv_camera","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyRobotCompany%2Fopencv_camera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyRobotCompany%2Fopencv_camera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyRobotCompany%2Fopencv_camera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyRobotCompany%2Fopencv_camera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MomsFriendlyRobotCompany","download_url":"https://codeload.github.com/MomsFriendlyRobotCompany/opencv_camera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253154977,"owners_count":21862623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apriltags","camera-calibration","opencv-python","python3"],"created_at":"2024-10-03T19:05:22.801Z","updated_at":"2025-05-08T22:14:07.720Z","avatar_url":"https://github.com/MomsFriendlyRobotCompany.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenCV Camera\n\n![CheckPackage](https://github.com/MomsFriendlyRobotCompany/opencv_camera/workflows/CheckPackage/badge.svg)\n![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/opencv_camera)\n[![Latest Version](https://img.shields.io/pypi/v/opencv_camera.svg)](https://pypi.python.org/pypi/opencv_camera/)\n[![image](https://img.shields.io/pypi/pyversions/opencv_camera.svg)](https://pypi.python.org/pypi/opencv_camera)\n[![image](https://img.shields.io/pypi/format/opencv_camera.svg)](https://pypi.python.org/pypi/opencv_camera)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/opencv_camera?color=aqua)\n\nSimple threaded camera and calibration code using OpenCV. This tries to simplify some things\n\n## Install\n\nThe preferred way to install is using `pip`:\n\n```\npip install opencv_camera\n```\n\n## Usage\n\nSee the jupyter notebooks under the `docs` in the repository for some examples.\n\nOnline [nbviewer](https://nbviewer.org/github/MomsFriendlyRobotCompany/opencv_camera/tree/master/docs/jupyter/)\n\n### Colorspace\n\nChange between common colorspaces with:\n\n- `bgr2gray(image)`\n- `gray2bgr(image)`\n- `bgr2rgb(image)`\n- `rgb2bgr(image)`\n- `bgr2hsv(image)`\n- `hsv2bgr(image)`\n\n### Calibration\n\nCreate a mosaic of input calibration images with `mosaic(images, width)`\n\n![](https://github.com/MomsFriendlyRobotCompany/opencv_camera/blob/master/pics/mosaic.png?raw=true)\n\nCalibrate a camera with:\n\n```python\ncalibrator = CameraCalibration()\nboard = ChessboardFinder((9,6), 1)\ncam, cal = calibrator.calibrate(images, board)\n```\n\nDisplay all of the found image points with `coverage((width, height), imagePoints)`\n\n![](https://github.com/MomsFriendlyRobotCompany/opencv_camera/blob/master/pics/target-points.png?raw=true)\n\n### Distortion\n\nUse the found calibration parameters to undistort an image:\n\n```python\nun = UnDistort(cameraMatrix, distortionCoeff, w, h)\ncorr_img = un.undistort(image)\n```\n\nVisualize the lens distortion with:\n\n```python\nvisualizeDistortion(cameraMatrix, distortCoeff, height, width)\n```\n\n![](https://github.com/MomsFriendlyRobotCompany/opencv_camera/blob/master/pics/py-dist.png?raw=true)\n\n### Stereo\n\nCalibrate a stereo camera with:\n\n```python\nstereoCal = StereoCalibration()\nboard = ChessboardFinder((9,6), 1)\nok, cm, sc = stereoCal.calibrate(imgL, imgR, board)\n```\n\nDraw epipolar lines in stereo images with `drawEpipolarLines(imgpointsL,imgpointsR,imgL,imgR)`\n\n![](https://github.com/MomsFriendlyRobotCompany/opencv_camera/blob/master/pics/epipolar.png?raw=true)\n\n## Apps\n\nUse `program --help` to display switches for each of the following:\n\n- `opencv_calibrate`: calibrate a camera\n- `opencv_capture`: simple tool to capture and save images\n- `opencv_mjpeg`: sets up a simple jmpeg server so you can view images in a web browser\n- `udp_server x.x.x.x`: sends camera images via UDP\n- `udp_client x.x.x.x`: displays UDP camera images from server\n\n# ToDo\n\n- [x] Removed `apriltag` calibration, moved to `moms_apriltag` library\n- [ ] Add pointcloud from stereo\n- [x] Add parameters for known cameras\n- [x] Add Jupyter notebook documentation and examples\n- [x] Simplify stereo camera\n- [x] Add `computeReprojectionErrors` and `visualizeReprojErrors`\n- [x] Add `visualizeDistortion`\n- [ ] Add `visualizeExtrinsics`\n- [x] Remove `attrs`, replaced with python's `dataclass`\n- [x] Add save/load from `yaml`\n- [x] Add stereo calibration `pytest`\n\n# Change Log\n\n| Date       | Version    | Notes                                     |\n|------------|------------|-------------------------------------------|\n|            | 2022.12.23 | changed version number to match date, changed to `opencv-contrib-python` |\n| 2020-12-27 | 0.10.10 | added distortion and reprojection display |\n| 2020-09-15 | 0.10.8 | added known camera params and general cleanup |\n| 2020-08-24 | 0.10.6 | added UDP image server and client |\n| 2020-07-03 | 0.10.2 | renamed and focused on camera |\n| 2018-07-19 |  0.9.4 | simple clean-up and updating some things |\n| 2017-10-29 |  0.9.3 | bug fixes |\n| 2017-04-09 |  0.9.0 | initial python 3 support |\n| 2017-03-31 |  0.7.0 | refactored and got rid of things I do not need |\n| 2017-01-29 |  0.6.0 | added video capture (video and images) program |\n| 2016-12-30 |  0.5.3 | typo fix |\n| 2016-12-30 |  0.5.1 | refactored |\n| 2016-12-11 |  0.5.0 | published to PyPi |\n| 2014-3-11  |  0.2.0 | started |\n\n# MIT License\n\n**Copyright (c) 2014 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlyrobotcompany%2Fopencv_camera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomsfriendlyrobotcompany%2Fopencv_camera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlyrobotcompany%2Fopencv_camera/lists"}