Hi,
I am trying to get the camera frames as described in the article here:
https://developer.vuforia.com/library/articles/Solution/How-To-Access-the-Camera-Image-in-Unity
But everytime i run this script it gives an error where it sets the camera frame instance
I am attaching the code as well.
I have also commented the line where it gives an error.
kindly help if anyone knows about this issue.
Type your code in the box. To create a new line within the box use SHIFT + ENTER. using UnityEngine; using System.Collections; using Vuforia; public class CameraFrame : MonoBehaviour { private Image.PIXEL_FORMAT m_PixelFormat = Image.PIXEL_FORMAT.RGB888; private bool m_RegisteredFormat = false; private bool m_LogInfo = false; public Image image; // Use this for initialization void Start () { VuforiaBehaviour vuforiaBehaviour = (VuforiaBehaviour)FindObjectOfType (typeof(VuforiaBehaviour)); if (vuforiaBehaviour) { vuforiaBehaviour.RegisterTrackablesUpdatedCallback (OnTrackablesUpdated); Debug.Log ("registered vuforia behaviour"); } } // Update is called once per frame void Update () { } public void OnTrackablesUpdated() { Debug.Log ("Trackable updated called"); if (!m_RegisteredFormat) { CameraDevice.Instance.SetFrameFormat(m_PixelFormat, true); //HERE IT GIVES THE ERROR m_RegisteredFormat = true; } if (m_LogInfo) { CameraDevice cam = CameraDevice.Instance; image = cam.GetCameraImage (m_PixelFormat); if (image == null) { Debug.Log (m_PixelFormat + " image is not available yet"); //boxMesh.material.mainTexture = tx; } else { string s = m_PixelFormat + " image: \n"; s += " size: " + image.Width + "x" + image.Height + "\n"; s += " bufferSize: " + image.BufferWidth + "x" + image.BufferHeight + "\n"; s += " stride: " + image.Stride; Debug.Log (s); } } } }
Hi! I have resolved this issue (Failed to set frame format) just used this construction