I am using PS3 Eye camera (model 5SLEH-00448) to take photos with OpenCV (C++) on Rapsberry Pi. It runs via v4l2 driver that only supports YUYV uncompressed capture mode. I save the images as PNG. I need uncompressed image with best possible quality.

Sample image in 320x240 (downsampled either by camera or by driver) - strange image artefacts can be seen on diagonal edges in the photos - when zoomed in there is a zig-zag artefact on the LCD screen's top edge which looks like a "staircase":

Strange image artefacts from PS3 Eye camera

The camera's native 640x480 looks quite decent (I can not see many artefacts there):

enter image description here

Here is the capture mode:

 $ v4l2-ctl --list-formats
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'YUYV'
    Name        : YUYV

Does anyone know what is happening? Looks like the native image looks quite good and the artefacts come from the downsampling algorithm in the driver probably?


1 Answer 1


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?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.