Search Unity

Webcam Image Entirely in Green and Purple (Wrong colors)

Discussion in 'Linux' started by iamBrandon, Mar 7, 2017.

  1. iamBrandon

    iamBrandon

    Joined:
    Jan 5, 2017
    Posts:
    2
    Hey everyone,

    I'm trying to interface with a webcam (see3cam usb 3.0) and when I run on linux, the coloration is entirely in shades of green and purple. This occurs when I directly run the application in Unity 5.5.2 in Linux and when I run a build of the application on the same Linux machine.

    The webcam image looks as expected when running the same unity code on a Mac and the webcam image is fine running in other Linux programs like QTCam. This issue occurs with both 64 bit and 32 bit builds. Finally, we didn't see this issue with a different physical webcam.

    Thanks for any suggestions.
     

    Attached Files:

  2. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    It sounds like mismatched color format expectations.
    Do you get warnings in your log like YUYV unavailable - falling back to RGB32?
     
  3. iamBrandon

    iamBrandon

    Joined:
    Jan 5, 2017
    Posts:
    2
    Thanks for the reply, Tak. I'm not seeing any error like that in the console when I run.. Is there somewhere else I can look or manually set this color format? I'm using a WebCamTexture and I only see options to view that information on a 2dTexture.
     
  4. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    That error would be in the log, but not printed to the console window. (You can open the log by clicking the tiny button at the upper right of the console window and choosing "Open Editor Log" from the context menu there, or by browsing to ~/.config/unity3d/Editor.log)

    No, it's all internal to the webcam texture implementation.
    We request YUYV from the camera, and if it reports that it doesn't support that, we request RGB32 (and if it reports that it doesn't support that, we give up and throw an exception).
     
  5. davidzz

    davidzz

    Joined:
    Jun 23, 2017
    Posts:
    1
    The chroma and Luma components in the image are swapped. Most likely the camera outputs YUYV but you are processing the data as UYVY or vice versa, Not in RGB32.
     
  6. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    That wouldn't explain why there's an issue with only one specific camera.
    It seems more likely that that camera(/driver) is publishing frames with those components swapped...
     
  7. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    Skype used to do this to me.
    I just opened camera settings (came with drivers) and set everything to default.
     
  8. magnomontDev

    magnomontDev

    Joined:
    Aug 20, 2020
    Posts:
    3
    Hello, I get this warning. In my case I am trying to take a video capture on ubuntu and my application is all black, that is, it does not show video: / Would anyone know how to solve it?

    Logs:

    Warning:
    YUYV unavailable - falling back to RGB32
    UnityEngine.WebCamTexturePlay()

    Error:
    No usable formats available!
    UnityEngine.WebCamTexturePlay()