Search Unity

Taking pictures with device webcam

Discussion in 'Getting Started' started by moidacarq, Aug 14, 2022.

  1. moidacarq

    moidacarq

    Joined:
    Aug 14, 2022
    Posts:
    1
    Hi guys,

    I am a PhD student and I am just starting to learn how to develop with Unity and HoloLens 2. I am trying to develop an app that can take pictures with the device's webcam and save them to a file. So far I can visualize my camera stream using very simple code but I am stuck. I have been looking for more documentation on this but there is so much outdated code out there that I thought it would be better to ask in a forum. Maybe this question has already been answered but I would like to verify first.

    My code for initializing the camera is:

    WebCamTexture webcam;
    Renderer rendererX;

    void Start()
    {
    //Initialize the webcam and apply the stream as a texture to the current object through its renderer
    webcam = new WebCamTexture();
    rendererX = GetComponent<Renderer>();
    rendererX.material.mainTexture = webcam;
    webcam.Play();
    }

    Thank you in advance for your answers.
     
  2. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    1) If you're displaying code, use CODE tags.
    2) Creating VR apps is pretty advanced stuff, not for beginners
     
  3. Cakebox

    Cakebox

    Joined:
    May 14, 2020
    Posts:
    11
    Hello!

    I've read your post a couple of times, but it's not clear to me what your question is.

    (I doubt that I can help personally, as I have no experience in this area, but I think you might have a better chance of finding those who can help if you clarify.)