Skip to content

fix(plugins/bithuman): drop the undeclared OpenCV import - #7406

Open
sgu-bithuman wants to merge 1 commit into
livekit:mainfrom
sgu-bithuman:bithuman-plugin-no-cv2
Open

sgu-bithuman wants to merge 1 commit into
livekit:mainfrom
sgu-bithuman:bithuman-plugin-no-cv2

Conversation

@sgu-bithuman

Copy link
Copy Markdown
Contributor

avatar.py imported cv2 at module scope for one call β€” a BGR->RGB channel
swap β€” and the plugin never declared OpenCV; it only worked because the
bithuman package happens to depend on opencv-python-headless. That
dependency is what makes bithuman collide with opencv-python (the two
distributions own the same cv2/ files, so installing one clobbers the
other's GUI build), and the plugin's import is the one thing stopping
bithuman from dropping it.

The swap is a numpy slice; np.ascontiguousarray(image[:, :, ::-1]) is
byte-identical to cv2.cvtColor(image, cv2.COLOR_BGR2RGB) for uint8 HxWx3
(checked on 1920x1080, 720x416 and 1x1 random frames). With this change the
plugin imports in an environment that has no OpenCV at all.

πŸ€– Generated with Claude Code

avatar.py imported cv2 at module scope for one call β€” a BGR->RGB channel
swap β€” and the plugin never declared OpenCV; it only worked because the
`bithuman` package happens to depend on opencv-python-headless. That
dependency is what makes `bithuman` collide with `opencv-python` (the two
distributions own the same `cv2/` files, so installing one clobbers the
other's GUI build), and the plugin's import is the one thing stopping
`bithuman` from dropping it.

The swap is a numpy slice; `np.ascontiguousarray(image[:, :, ::-1])` is
byte-identical to `cv2.cvtColor(image, cv2.COLOR_BGR2RGB)` for uint8 HxWx3
(checked on 1920x1080, 720x416 and 1x1 random frames). With this change the
plugin imports in an environment that has no OpenCV at all.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EikUAV1MVst2oNsvDejqLJ
@sgu-bithuman
sgu-bithuman requested a review from a team as a code owner September 23, 2026 03:10

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

βœ… Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch has not been deployed

No deployments
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.

1 participant