Why do 320×240 captures from a PS3 Eye show jagged diagonal edges when using YUYV?
Asked 3/21/2017
3 views
2 answers
0
I’m capturing stills from a PS3 Eye on a Raspberry Pi with OpenCV through the v4l2 driver. The camera only exposes YUYV capture, and I save the frames as PNG. At the camera’s native 640×480 the image looks reasonably clean, but at 320×240 I see obvious stair-stepping/jagged artifacts on diagonal and vertical color edges. It looks worse on edges where both brightness and color change. Is this likely caused by the way the lower-resolution image is being generated from YUYV, such as a poor downsampling step in the driver or pipeline?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
9y ago
2 Answers
4
In the YUYV format, the luma channel (Y) which controls the pixels brightness has a higher resolution than the chrominance (U and V) channels, which control the hue. Each pixel has its own brightness information, but two following pixels share the hue value.
Your small image looks as if the downsampling algorithm has operated independently on the Y and on the UV channels, ignoring that different hues have a different perceived brightness. This will cause such artifacts on vertical or diagonal edges, if not only the brightness, but also the hue change from one side of the edge to the other. As you can see, the edge between the bookshelf and the wall above the monitor is not so strongly affected, since both sides of the edge share a similar hue.
I am not familiar with the software you are using and can't give you an out of the box solution, but if the YUYV downsampling algorithm is so broken, perhaps you can convert the input image to RGB before downsampling and then either continue working with the RGB data or convert back to YUYV if you for some reason need the downsampled image in YUYV format?
Originally by user10009. Source · Licensed CC BY-SA 4.0
user10009
9y ago
0
Generated from our catalog & community — verify before relying on it.
Yes — this is consistent with how YUYV 4:2:2 data can misbehave if it’s downsampled poorly.
In YUYV, every pixel has full luma (Y, brightness) resolution, but chroma (U and V, color) is shared between pairs of pixels. If the 320×240 image is produced by downsampling the Y and UV components independently, without properly accounting for the lower chroma resolution and the relationship between color and perceived brightness, diagonal and vertical color edges can turn into jagged “staircase” artifacts.
That matches your example: edges where both hue and brightness change are affected more strongly, while edges with similar hue on both sides look cleaner.
So the issue is likely not PNG or “compression,” but the low-resolution conversion/downsampling path from YUYV. The cleaner 640×480 result suggests the sensor’s native mode is fine, and the artifacts appear when generating 320×240.
If possible, capture at 640×480 and resize afterward with a better resampling method in software rather than relying on the driver/camera to produce 320×240 directly.
Recommended products
UniqueBot
AI9y ago
Your Answer
Related Questions
Why are Raspberry Pi Camera images darker at 90 fps, and how can I improve them?
How can I evenly light the inside of an incubator for time-lapse through the window?
How can I remove a red/magenta tint in cave shadows for a large Milky Way print?
Why do scanned CCD images show RGB color fringes, and how can I correct them?