public static T[] Image2RealArray <T>(Bitmap input, bool isNorm = true, bool isToBgrArray = false, T[] bias = null) where T : unmanaged, IComparable <T> { if (typeof(T) == typeof(float)) { return((T[])(object)BitmapConverterF.Image2RealArray(input, isNorm, isToBgrArray)); } if (typeof(T) == typeof(double)) { return((T[])(object)BitmapConverterD.Image2RealArray(input, isNorm, isToBgrArray)); } throw new Exception(); }
public static Bitmap[] NdArray2Image <T>(NdArray <T> input, bool isNorm = true, bool isFromBgrArray = false) where T : unmanaged, IComparable <T> { if (input is NdArray <float> inputF) { return(BitmapConverterF.NdArray2Image(inputF, isNorm, isFromBgrArray)); } if (input is NdArray <double> inputD) { return(BitmapConverterD.NdArray2Image(inputD, isNorm, isFromBgrArray)); } throw new Exception(); }