Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Convert BGR to RGB color space for correct video colors #338

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

robotlovehuman
Copy link
Contributor

Video Feed Color Correction

Issue

  • Video feed shows blue tint due to BGR/RGB colorspace mismatch between OpenCV and PIL
  • OpenCV captures in BGR format while PIL expects RGB

Fix

  • Added cv2.cvtColor conversion before PIL processing
  • Converts OpenCV's BGR output to RGB before PIL processing
  • Added explanatory comments for future maintainers

Testing

  • Tested with live video feed
  • Confirms correct color reproduction without blue tint
  • No impact on performance or other functionality

Technical Details

  • Modified _get_frame method to include color space conversion
  • Uses cv2.COLOR_BGR2RGB for correct color mapping
  • Maintains existing image processing pipeline

- Added cv2.cvtColor conversion before PIL processing
- Fixes blue tint issue in video feed
- Ensures correct color representation in Gemini 2.0 Live API video feed
- Added explanatory comments for future maintainers

Issue: Video feed shows blue tint due to BGR/RGB colorspace mismatch
Solution: Convert OpenCV BGR output to RGB before PIL processing
Copy link

google-cla bot commented Dec 12, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added the status:awaiting review PR awaiting review from a maintainer label Dec 12, 2024
@robotlovehuman
Copy link
Contributor Author

/check-cla

Copy link
Member

@markmcd markmcd left a comment

Choose a reason for hiding this comment

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

Fantastic - thanks for the fix!

@markmcd markmcd merged commit 67633d3 into google-gemini:main Dec 12, 2024
3 checks passed
@robotlovehuman
Copy link
Contributor Author

robotlovehuman commented Dec 12, 2024 via email

@robotlovehuman
Copy link
Contributor Author

/check-cla

@MarkDaoust
Copy link
Contributor

Thanks @robotlovehuman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:awaiting review PR awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants