{"id":23871217,"url":"https://github.com/yushulx/python-lite-camera","last_synced_at":"2025-04-04T11:16:47.146Z","repository":{"id":57690878,"uuid":"100690159","full_name":"yushulx/python-lite-camera","owner":"yushulx","description":"A lightweight, cross-platform library for capturing RGB frames from cameras","archived":false,"fork":false,"pushed_at":"2025-01-23T03:18:06.000Z","size":1388,"stargazers_count":99,"open_issues_count":5,"forks_count":33,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T10:07:21.549Z","etag":null,"topics":["camera","python","webcam"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/lite-camera/","language":"C","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/yushulx.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-18T08:22:03.000Z","updated_at":"2025-02-12T13:28:05.000Z","dependencies_parsed_at":"2025-01-27T18:17:16.735Z","dependency_job_id":null,"html_url":"https://github.com/yushulx/python-lite-camera","commit_stats":null,"previous_names":["yushulx/python-lite-camera","yushulx/python-capture-device-list"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fpython-lite-camera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fpython-lite-camera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fpython-lite-camera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fpython-lite-camera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yushulx","download_url":"https://codeload.github.com/yushulx/python-lite-camera/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166171,"owners_count":20894654,"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":["camera","python","webcam"],"created_at":"2025-01-03T14:17:13.182Z","updated_at":"2025-04-04T11:16:47.126Z","avatar_url":"https://github.com/yushulx.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LiteCam for Python\n[LiteCam](https://github.com/yushulx/cmake-cpp-barcode-qrcode-mrz/tree/main/litecam) is a lightweight, cross-platform library for capturing RGB frames from cameras and displaying them. Designed with simplicity and ease of integration in mind, LiteCam supports **Windows**, **Linux** and **macOS** platforms. It integrates easily with image processing frameworks like **OpenCV**, making it a versatile choice for developers.\n\n![lite camera for Python](https://www.dynamsoft.com/codepool/img/2025/01/lite-camera-python.png)\n\n## Features\n\n- Capture RGB frames from video devices.\n- Display live frames in a window.\n- Draw contours and text directly on the displayed frames.\n- Simple API for quick integration.\n\n## Supported Platforms\n\n- **Windows**\n- **Linux**\n- **macOS**\n\n## How to Build the CPython Extension    \n- Development Mode\n    \n    ```bash\n    python setup.py develop\n    ```\n\n- Wheel Package\n\n    ```bash\n    python setup.py bdist_wheel\n    ```\n\n- Source Distribution\n\n    ```bash\n    python setup.py sdist\n    ```\n\n## Usage\n\n### Basic Example\n\n```python\nimport litecam\n\ncamera = litecam.PyCamera()\n\nif camera.open(0):\n\n    window = litecam.PyWindow(\n        camera.getWidth(), camera.getHeight(), \"Camera Stream\")\n\n    while window.waitKey('q'):\n        frame = camera.captureFrame()\n        if frame is not None:\n            width = frame[0]\n            height = frame[1]\n            size = frame[2]\n            data = frame[3]\n            window.showFrame(width, height, data)\n\n    camera.release()\n```\n\n### API Overview\n\n- **getDeviceList()**: Lists available video capture devices.\n- **saveJpeg(filename, width, height, rgbdata)**: Saves the frame as a JPEG image.\n\n#### PyCamera\n- **open(index)**: Opens the camera with the specified index.\n- **listMediaTypes()**: Lists supported media types.\n- **setResolution(int width, int height)**: Sets the resolution for the camera.\n- **captureFrame()`**: Captures a single RGB frame.\n- **release()**: Closes the camera and releases resources.\n- **getWidth()**: Returns the width of the frame.\n- **getHeight()**: Returns the height of the frame.\n\n#### PyWindow\n- **waitKey(key)**: Waits for user input; returns `false` if the specified key is pressed or the window is closed.\n- **showFrame(width, height, rgbdata)**: Displays an RGB frame.\n- **drawContour(points)**: Draws contours on the frame.\n- **drawText(text, x, y, fontSize, color)**: Draws text on the frame.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushulx%2Fpython-lite-camera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyushulx%2Fpython-lite-camera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushulx%2Fpython-lite-camera/lists"}