Esempio n. 1
0
 private IEnumerator PrepareImage(System.Action <Color32[]> callback)
 {
     // Corrutine that crops the image in a square
     StartCoroutine(
         TextureUtils.CropSquare(m_InputCamera,
                                 RectOptions.Center,
                                 cropedTexture => {
         // Scale image to the desired 416 px
         var scaledTexture = TextureUtils.ScaleTexture(cropedTexture, ObjectDetector.ImageNetSettings.imageWidth, ObjectDetector.ImageNetSettings.imageHeight, FilterMode.Bilinear);
         // Rotate Image
         var rotatedTexture = TextureUtils.RotateImageMatrix(scaledTexture.GetPixels32(), ObjectDetector.ImageNetSettings.imageWidth, ObjectDetector.ImageNetSettings.imageHeight, -90);
         // Execute callback (ObjectDetector) once the image is done
         callback(rotatedTexture);
     }));
     yield return(null);
 }