fix(plugins/bithuman): drop the undeclared OpenCV import - #7406
Open
sgu-bithuman wants to merge 1 commit into
Open
sgu-bithuman wants to merge 1 commit into
sgu-bithuman wants to merge 1 commit into
Conversation
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
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
bithumanpackage happens to depend on opencv-python-headless. Thatdependency is what makes
bithumancollide withopencv-python(the twodistributions own the same
cv2/files, so installing one clobbers theother's GUI build), and the plugin's import is the one thing stopping
bithumanfrom dropping it.The swap is a numpy slice;
np.ascontiguousarray(image[:, :, ::-1])isbyte-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