Exemplo n.º 1
0
        public static Bitmap[] NdArray2Image(NdArray input, bool isNorm = true, bool isFromBgrArray = false)
        {
            Bitmap[] result = new Bitmap[input.BatchCount];

            for (int i = 0; i < result.Length; i++)
            {
                NdArray tmp = input.GetSingleArray(i);

                if (input.Shape.Length == 2)
                {
                    result[i] = CreateMonoImage(tmp.Data, input.Shape[0], input.Shape[1], isNorm);
                }
                else if (input.Shape.Length == 3)
                {
                    if (input.Shape[0] == 1)
                    {
                        result[i] = CreateMonoImage(tmp.Data, input.Shape[1], input.Shape[2], isNorm);
                    }
                    else if (input.Shape[0] == 3)
                    {
                        result[i] = CreateColorImage(tmp.Data, input.Shape[1], input.Shape[2], isNorm, isFromBgrArray);
                    }
                }
            }

            return(result);
        }