Add YUYV stream conversion test#14561
Add YUYV stream conversion test#14561ttkhuong wants to merge 1 commit intorealsenseai:developmentfrom
Conversation
|
Can one of the admins verify this patch? |
|
Rebase |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
| color_sensor.open(profile_rgb8) | ||
| color_sensor.start(rgb8_callback) | ||
|
|
||
| timer = Timer(10) |
There was a problem hiding this comment.
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.
Tracked-on: LRS-1277
This test checks YUYV format streaming and compares color accuracy with RGB8 format