public void Execute() { this.debugText1.text = "0"; this.guideFace.SetActive(true); /* * Texture2D t = Resources.Load("red_curtain") as Texture2D; * this.curtainImage.GetComponent<RawImage>().texture = t; * this.curtainImage.SetActive(true); */ SortingDeepHat.hogwartsHouse house = SortingDeepHat.hogwartsHouse.Gryffindor; bool isOk = Predict(ref house); this.msgText.text = house.ToString(); }
private bool Predict(ref SortingDeepHat.hogwartsHouse house) { bool ret = false; bool isStartOk = this.faceTrack.GetFaceTrackOk(); if (isStartOk) { Mat faceImg = new Mat(SortingDeepHat.IMG_WIDTH, SortingDeepHat.IMG_HEIGHT, CvType.CV_8UC3); bool isOk = this.faceTrack.GetFaceImg(faceImg); if (isOk == false) { return(false); } Mat inputData = new Mat(faceImg.width(), faceImg.height(), CvType.CV_32FC3); this.hat.PreProcess(faceImg, inputData); SortingDeepHat.hogwartsHouse h = SortingDeepHat.hogwartsHouse.Gryffindor; float value = 0.0f; this.hat.Sort(inputData, ref h, ref value); house = h; this.msgText.text = house.ToString(); Texture2D t = new Texture2D(faceImg.cols(), faceImg.rows(), TextureFormat.RGBA32, false); Utils.matToTexture2D(faceImg, t); this.debugImg2.texture = t; faceImg.Dispose(); inputData.Dispose(); ret = true; } return(ret); }