Skip to content

Add camera-id option for stable camera selection#25

Merged
haixuanTao merged 4 commits intomainfrom
feat/opencv-camera-id
Jan 28, 2026
Merged

Add camera-id option for stable camera selection#25
haixuanTao merged 4 commits intomainfrom
feat/opencv-camera-id

Conversation

@haixuanTao
Copy link
Copy Markdown
Contributor

Summary

  • Add --camera-id / CAMERA_ID option to select camera by unique identifier instead of index
  • Support macOS (system_profiler), Linux (/dev/v4l/by-id/), and Windows (PowerShell Get-PnpDevice)
  • Print camera name and unique ID when opening by index for easy discovery

This makes camera selection more reliable when multiple cameras are connected or when cameras are plugged/unplugged (which can change indices).

Usage

# Find your camera's unique ID
system_profiler SPCameraDataType  # macOS
ls /dev/v4l/by-id/                # Linux
Get-PnpDevice -Class Camera       # Windows (PowerShell)

# Use the unique ID
--camera-id "0x222000080860b5b"
# or
CAMERA_ID=0x222000080860b5b

Test plan

  • Test on macOS with RealSense camera
  • Test fallback to index when camera-id not specified
  • Verify error message when camera-id not found

🤖 Generated with Claude Code

Add support for selecting cameras by unique ID instead of index, which is
more reliable when multiple cameras are connected or cameras are plugged/unplugged.

- Add --camera-id / CAMERA_ID option to select camera by unique identifier
- Support macOS (system_profiler), Linux (/dev/v4l/by-id/), and Windows (PowerShell)
- Print camera name and unique ID when opening by index for easy discovery

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kush124k
Copy link
Copy Markdown
Contributor

I think I know what to change in it.

@haixuanTao
Copy link
Copy Markdown
Contributor Author

@claude can you fix this PR linting error

2 similar comments
@haixuanTao
Copy link
Copy Markdown
Contributor Author

@claude can you fix this PR linting error

@haixuanTao
Copy link
Copy Markdown
Contributor Author

@claude can you fix this PR linting error

@claude
Copy link
Copy Markdown

claude bot commented Jan 26, 2026

Claude finished @haixuanTao's task in 2m 18s —— View job


Fixing PR Linting Errors ✓

  • Check CI status to identify linting errors
  • Read the modified Python file
  • Fix linting issues
  • Commit and push changes

Fixed the following linting issues in opencv_video_capture/main.py:

  • Added proper module and function docstrings (pydocstyle compliance)
  • Fixed dictionary formatting for better readability
  • Split long lines to comply with line length limits (80-88 characters)
  • Improved string formatting with proper line breaks

Changes have been committed and pushed to the feat/opencv-camera-id branch.

--- |

- Add proper module and function docstrings for pydocstyle compliance
- Fix dictionary formatting
- Split long lines to comply with line length limits
- Improve string formatting for better readability

Co-authored-by: Haixuan Xavier Tao <haixuanTao@users.noreply.github.com>
@haixuanTao
Copy link
Copy Markdown
Contributor Author

@claude can you fix this PR linting error

@claude
Copy link
Copy Markdown

claude bot commented Jan 26, 2026

Claude finished @haixuanTao's task in 2m 55s —— View job


Fixing PR Linting Errors ✓

  • Check CI status to identify linting errors
  • Review code for common linting issues
  • Fix identified linting issues
  • Commit and push changes

Fixed the following linting issues in opencv_video_capture/main.py:

  • Import ordering: Moved json import to top-level imports alongside other standard library imports (ruff I rule compliance)
  • Simplified expression: Changed RUNNER_CI = True if os.getenv("CI") == "true" else False to RUNNER_CI = os.getenv("CI") == "true" (ruff UP rule - unnecessary ternary)

Changes have been committed and pushed to the feat/opencv-camera-id branch in commit a46b1ed.

--- |

- Move json import to top-level imports for proper import ordering
- Simplify ternary expression for RUNNER_CI assignment

Co-authored-by: Haixuan Xavier Tao <haixuanTao@users.noreply.github.com>
@kush124k
Copy link
Copy Markdown
Contributor

@haixuanTao Can I do it,,,,,,

@haixuanTao
Copy link
Copy Markdown
Contributor Author

Sure! @kush124k

@kush124k
Copy link
Copy Markdown
Contributor

@haixuanTao
Done! I've fixed the PERF401 (list extension) and D413 (docstring spacing) errors locally.
You can pull my fixes directly into this branch with:

Bash
git pull https://github.com/kush124k/dora-hub.git fix-linting-pr-25
This should make the CI checks green.

@haixuanTao haixuanTao merged commit f066219 into main Jan 28, 2026
131 checks passed
@haixuanTao
Copy link
Copy Markdown
Contributor Author

@kush124k Thanks!

@haixuanTao haixuanTao deleted the feat/opencv-camera-id branch January 28, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants