-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Describe the bug
When passing the data through UVC, the GC2145 does get video in, but the red and blue channels are swapped. Skin appears blue-ish, and LED tests show red and blue colors swapped.
To Reproduce
Get a working debug environment:
git remote add tvai https://github.com/tinyvision-ai-inc/zephyr
git fetch tvai
git cherry-pick tvai/pr-video-shell~1..tvai/pr-video-shell
git cherry-pick tvai/pr-usb-uvc~4..tvai/pr-usb-uvc
git cherry-pick tvai/pr-video-nicla-sample
Build UVC sample with the Zephyr Video shell (to toggle vflip):
west build --board arduino_nicla_vision/stm32h747xx/m7 samples/subsys/usb/uvc/ -- \
-DCONFIG_SHELL=y -DCONFIG_VIDEO_SHELL=y
west flash
ffplay /dev/video2
Expected behavior
Natural-looking color with correct mapping of red and blue.
Impact
None: it's not yet possible to see the data with upstream Zephyr, just anticipation.
Logs and console output
I thought this was due to the horizontal flip (swapping bayer pattern at input) but apparently not, the image is flipped but color channels are still wrong:
$ picocom -b 115200 /dev/ttyACM0
uart:~$ video ctrl gc2145@3c horizontal_flip on
Setting control 'horizontal_flip' (0x00980914) to value 'on' (1)
uart:~$ video ctrl gc2145@3c horizontal_flip off
Setting control 'horizontal_flip' (0x00980914) to value 'off' (0)
Environment (please complete the following information):
- OS: Linux
- Zephyr SDK
- Commit is combined from above cherry-pick on top of fb1161a
Additional context
Input:
Output:
The format selected by Linux was YUYV:
[174074.271489] usb 1-4.3.2: Product: UVC sample
[174074.271494] usb 1-4.3.2: Manufacturer: Zephyr Project
[174074.271498] usb 1-4.3.2: SerialNumber: 0030003B3532510437383631
[174074.275518] usb 1-4.3.2: Probing generic UVC device 4.3.2
[174074.275553] usb 1-4.3.2: Found format RGBP little-endian (0x50424752)
[174074.275561] usb 1-4.3.2: - 320x240 (0.4 fps)
[174074.275567] usb 1-4.3.2: - 640x480 (0.4 fps)
[174074.275572] usb 1-4.3.2: - 1600x1200 (0.4 fps)
[174074.275576] usb 1-4.3.2: Found format YUYV little-endian (0x56595559)
[174074.275581] usb 1-4.3.2: - 320x240 (0.4 fps)
[174074.275585] usb 1-4.3.2: - 640x480 (0.4 fps)
[174074.275589] usb 1-4.3.2: - 1600x1200 (0.4 fps)
[174074.275602] usb 1-4.3.2: Found UVC 1.50 device UVC sample (2fe3:0011)
[174074.275612] usb 1-4.3.2: Scanning UVC chain:
[174074.275615] OT 5 <- XU 4 <- PU 3 <- SU 2 <- IT 1
[174074.275631] usb 1-4.3.2: Found a valid video chain (1 -> 5)
[174074.277657] usb 1-4.3.2: UVC device initialized
[174074.287104] usb 1-4.3.2: uvc_v4l2_open
[174074.287226] usb 1-4.3.2: uvc_v4l2_release
[174076.776178] usb 1-4.3.2: Suspending interface 1
[174076.776191] usb 1-4.3.2: Suspending interface 0
[174083.218264] usb 1-4.3.2: uvc_v4l2_open
[174083.278983] usb 1-4.3.2: Resuming interface 0
[174083.278996] usb 1-4.3.2: Resuming interface 1
[174083.279047] usb 1-4.3.2: Trying format 0x32315559 (YU12): 320x240
[174083.279056] usb 1-4.3.2: Using default frame interval 2026253.6 us (0.4 fps)
[174083.280475] usb 1-4.3.2: Trying format 0x32315559 (YU12): 320x240
[174083.280494] usb 1-4.3.2: Using default frame interval 2026253.6 us (0.4 fps)
[174083.281859] usb 1-4.3.2: Trying format 0x32315659 (YV12): 320x240
[174083.281872] usb 1-4.3.2: Using default frame interval 2026253.6 us (0.4 fps)
[174083.283430] usb 1-4.3.2: Trying format 0x50323234 (422P): 320x240
[174083.283447] usb 1-4.3.2: Using default frame interval 2026253.6 us (0.4 fps)
[174083.284750] usb 1-4.3.2: Trying format 0x56595559 (YUYV): 320x240
[174083.284761] usb 1-4.3.2: Using default frame interval 2026253.6 us (0.4 fps)
...

