Skip to content

Add YUYV stream conversion test#14561

Open
ttkhuong wants to merge 1 commit intorealsenseai:developmentfrom
ttkhuong:LRS-1277
Open

Add YUYV stream conversion test#14561
ttkhuong wants to merge 1 commit intorealsenseai:developmentfrom
ttkhuong:LRS-1277

Conversation

@ttkhuong
Copy link
Contributor

@ttkhuong ttkhuong commented Dec 31, 2025

Tracked-on: LRS-1277
This test checks YUYV format streaming and compares color accuracy with RGB8 format

@sysrsbuild-gh
Copy link

Can one of the admins verify this patch?

Copilot AI review requested due to automatic review settings January 15, 2026 23:08
@ttkhuong
Copy link
Contributor Author

Rebase

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new test to verify YUYV format streaming functionality and validate color accuracy by comparing converted YUYV data against native RGB8 format.

Changes:

  • Added a new test file that streams both YUYV and RGB8 formats from a RealSense color sensor
  • Implemented YUYV to RGB8 conversion logic and color comparison utilities
  • Validates that color differences between formats stay within acceptable tolerance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +62
r = np.clip(y + 1.402 * (v_expanded - 128), 0, 255).astype(np.uint8)
g = np.clip(y - 0.344136 * (u_expanded - 128) - 0.714136 * (v_expanded - 128), 0, 255).astype(np.uint8)
b = np.clip(y + 1.772 * (u_expanded - 128), 0, 255).astype(np.uint8)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The magic numbers 1.402, 0.344136, 0.714136, 1.772, and 128 used in the YUV to RGB conversion formula should be extracted as named constants to improve code clarity and maintainability.

Copilot uses AI. Check for mistakes.
color_sensor.open(profile_rgb8)
color_sensor.start(rgb8_callback)

timer = Timer(10)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The timeout value 10 is duplicated at lines 95 and 132. Consider extracting this as a named constant like STREAM_TIMEOUT_SECONDS to avoid duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
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.

3 participants