예제 #1
0
        /// <summary>
        /// Converts a Bitmap to an RGB tensor array.
        /// </summary>
        /// <param name="Data">Bitmap</param>
        /// <returns>RGB tensor array</returns>
        public static byte[] ToTensor(this Bitmap Data)
        {
            BitmapData bmData = Onnx.Lock24bpp(Data);

            byte[] rgb = Onnx.ToTensor(bmData);
            Onnx.Unlock(Data, bmData);
            return(rgb);
        }
예제 #2
0
        /// <summary>
        /// Converts an RGB tensor array to a color image.
        /// </summary>
        /// <param name="tensor">RGBA tensor array</param>
        /// <param name="width">Bitmap width</param>
        /// <param name="height">Bitmap height</param>
        /// <param name="Data">Bitmap</param>
        public static void FromSegmentationMap(long[] tensor, int width, int height, Bitmap Data)
        {
            BitmapData bmData = Onnx.Lock24bpp(Data);

            FromSegmentationMap(tensor, width, height, bmData);
            Onnx.Unlock(Data, bmData);
            return;
        }
예제 #3
0
        /// <summary>
        /// Converts an RGB tensor array to a color image.
        /// </summary>
        /// <param name="tensor">RGBA tensor array</param>
        /// <param name="width">Bitmap width</param>
        /// <param name="height">Bitmap height</param>
        /// <param name="Data">Bitmap</param>
        public static void FromTensor(this byte[] tensor, int width, int height, Bitmap Data)
        {
            BitmapData bmData = Onnx.Lock24bpp(Data);

            FromTensor(tensor, width, height, bmData);
            Onnx.Unlock(Data, bmData);
            return;
        }