# 电脑摄像头检测器 **Repository Path**: Snake-Konginchrist/CameraDetector ## Basic Information - **Project Name**: 电脑摄像头检测器 - **Description**: 这个项目是一个使用Python和OpenCV开发的摄像头检测器,能够自动识别并显示连接到电脑的所有摄像头。它支持获取摄像头的具体名称,为用户提供一个简单的图形界面来选择并查看选定摄像头的实时视频流。项目旨在为需要快速检测和测试电脑摄像头的用户提供便利。 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2024-03-26 - **Last Updated**: 2026-03-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: 摄像头 ## README # 电脑摄像头检测器 一个支持Windows、macOS和Linux的摄像头检测和显示工具。 ## 功能特性 - ✅ 跨平台支持(Windows/macOS/Linux) - ✅ 自动检测所有连接的摄像头 - ✅ 显示摄像头实时视频流 - ✅ 友好的图形用户界面 - ✅ 支持多个摄像头同时显示 ## 系统要求 ### Windows - Windows 7/8/10/11 - Python 3.7+ - OpenCV支持DirectShow ### macOS - macOS 10.12+ - Python 3.7+ - OpenCV支持AVFoundation ### Linux - Ubuntu 16.04+ 或其他现代Linux发行版 - Python 3.7+ - OpenCV支持V4L2 - v4l-utils(可选,用于获取摄像头详细信息) ## 安装 1. 克隆或下载本项目 2. 安装依赖: ```bash pip install -r requirements.txt ``` ### 平台特定安装说明 #### macOS ```bash # 如果使用Homebrew安装的Python pip3 install -r requirements.txt ``` #### Linux (Ubuntu/Debian) ```bash # 安装系统依赖 sudo apt update sudo apt install python3-pip python3-tk v4l-utils # 安装Python依赖 pip3 install -r requirements.txt ``` #### Linux (CentOS/RHEL) ```bash # 安装系统依赖 sudo yum install python3-pip python3-tk v4l-utils # 安装Python依赖 pip3 install -r requirements.txt ``` ## 使用方法 1. 运行程序: ```bash python main.py ``` 2. 程序会自动检测所有连接的摄像头 3. 从下拉菜单选择要查看的摄像头 4. 点击"显示摄像头"按钮查看实时视频 ## 故障排除 ### macOS - 首次运行可能需要授予摄像头访问权限 - 如果无法检测到摄像头,请检查系统偏好设置 > 安全性与隐私 > 摄像头 ### Linux - 如果摄像头无法打开,请检查用户是否在`video`组: ```bash sudo usermod -a -G video $USER ``` - 安装v4l-utils获取更详细的摄像头信息: ```bash sudo apt install v4l-utils ``` ### 通用问题 - 确保没有其他程序正在使用摄像头 - 检查摄像头是否正确连接 - 尝试重启程序或电脑 ## 测试 运行兼容性测试来验证系统环境和依赖安装: ```bash python test_compatibility.py ``` 测试脚本会: - 检查Python版本和操作系统 - 验证所有依赖包是否正确安装 - 测试摄像头检测功能 - 显示详细的测试报告 ## 开发说明 项目结构: - `main.py` - 主程序入口 - `camera_detector.py` - 摄像头检测逻辑 - `camera_display.py` - 摄像头显示功能 - `test_compatibility.py` - 兼容性测试脚本 - `requirements.txt` - 项目依赖 ## 技术栈 - Python 3.6+ - OpenCV - Tkinter - pywin32 (仅限Windows) ## 贡献指南 我们欢迎所有形式的贡献,无论是新功能的建议,代码修补,还是文档改进。请通过GitHub的Issue和Pull Request机制提交您的贡献。 ## 许可证 本项目采用MIT许可证。详情请见[LICENSE](LICENSE)文件。 ## 联系方式 如有任何问题或建议,请通过以下方式联系我们: - 邮箱:developer@skstudio.cn