public void Start()
    {
        xr_ = GameObject.FindWithTag("XRController").GetComponent <XRController>();

        if (detectionTextures.Count > 0)
        {
            Dictionary <string, XRDetectionImage> detectionImages =
                new Dictionary <string, XRDetectionImage>();
            foreach (XRDetectionTexture detectionTexture in detectionTextures)
            {
                detectionImages.Add(
                    detectionTexture.tex.name, XRDetectionImage.FromDetectionTexture(detectionTexture));
            }
            xr_.SetDetectionImages(detectionImages);
        }
    }
예제 #2
0
    // Save each target image into XRDetectionTexture list
    public void SaveImage(XRDetectionTexture tex)
    {
        Debug.Log("Saving Image");
        texHandler = new List <XRDetectionTexture>();
        int x = 0;

        texHandler.Capacity = Targets.Capacity;
        Debug.Log(texHandler.Capacity);
        for (x = 0; x < texHandler.Capacity; x++)
        {
            texHandler.Insert(x, tex);
        }

        if (texHandler.Count == TI.Capacity)
        {
            detectionTextures = new List <XRDetectionTexture>(texHandler.Count);


            int i = 0;
            for (i = 0; i < detectionTextures.Capacity; i++)
            {
                detectionTextures.Add(texHandler[i]);
                Debug.Log(texHandler[i]);
            }


            xr_ = GameObject.FindWithTag("XRController").GetComponent <XRController>();

            if (detectionTextures.Count > 0)
            {
                Dictionary <string, XRDetectionImage> detectionImages =
                    new Dictionary <string, XRDetectionImage>();
                foreach (XRDetectionTexture detectionTexture in detectionTextures)
                {
                    detectionImages.Add(
                        detectionTexture.tex.name, XRDetectionImage.FromDetectionTexture(detectionTexture));
                }
                xr_.SetDetectionImages(detectionImages);
                Debug.Log("DetectionImages Count is: " + detectionImages.Count);
            }
        }
        Debug.Log("Saved");
        Debug.Log(texHandler[0]);
        Debug.Log(texHandler[0].tex.name);
    }