public void NetworkIntegrationTest() { NNRunner runner = NNRunner.Instance; Texture2D input = new Texture2D(224, 224, TextureFormat.RGBA32, false); runner.Invoke(input); var results = runner.GetResults(); Assert.That((int)results.Length, Is.EqualTo((int)JointIndex.COUNT)); }
void Start() { string path = Path.Combine(Application.streamingAssetsPath, fileName); network = NNRunner.Instance; WebCamDevice[] devices = WebCamTexture.devices; webcamTexture = new WebCamTexture(devices[0].name); GameObject videoScreen = GameObject.Find("VideoScreen"); RawImage screen = videoScreen.GetComponent <RawImage>(); var sd = screen.GetComponent <RectTransform>(); screen.texture = webcamTexture; webcamTexture.Play(); sd.sizeDelta = new Vector2(videoScreenWidth, (int)(videoScreenWidth * webcamTexture.height / webcamTexture.width)); texture = new Texture2D(webcamTexture.width, webcamTexture.height); // Clip size videoWidth = texture.width; videoHeight = texture.height; float padWidth = (videoWidth < videoHeight) ? 0 : (videoHeight - videoWidth) / 2; float padHeight = (videoWidth < videoHeight) ? (videoWidth - videoHeight) / 2 : 0; if (clipScale == 0f) { clipScale = 0.001f; } var w = (videoWidth + padWidth * 2f) * clipScale; padWidth += w; padHeight += w; clipRect = new UnityEngine.Rect(-padWidth, -padHeight, videoWidth + padWidth * 2, videoHeight + padHeight * 2); /* * networkInputs = new Texture[1]; * networkInputs[0] = webcamTexture; * * glDrawer.OnDraw += OnGLDraw; * * imageRotation.eulerAngles = new Vector3(0, 0, 180); * * Vector3 test = new Vector3(1, 0, 0); * Debug.Log(imageRotation * test); */ results = new NetworkResult[(int)JointIndex.COUNT]; }