Exemplo n.º 1
0
        private static RGBLuminanceSource.BitmapFormat GetOptimumPixelFormats(MatType type)
        {
            if (type == MatType.CV_8UC1 || type == MatType.CV_8SC1)
            {
                return(RGBLuminanceSource.BitmapFormat.Gray8);
            }
            if (type == MatType.CV_8UC3 || type == MatType.CV_8SC3)
            {
                return(RGBLuminanceSource.BitmapFormat.BGR24);
            }
            if (type == MatType.CV_8UC4 || type == MatType.CV_8SC4)
            {
                return(RGBLuminanceSource.BitmapFormat.BGRA32);
            }

            //if (type == MatType.CV_16UC1 || type == MatType.CV_16SC1)
            //   return RGBLuminanceSource.BitmapFormat.Gray16;
            //if (type == MatType.CV_16UC3 || type == MatType.CV_16SC3)
            //   return RGBLuminanceSource.BitmapFormat.Rgb48;
            //if (type == MatType.CV_16UC4 || type == MatType.CV_16SC4)
            //   return RGBLuminanceSource.BitmapFormat.Rgba64;

            //if (type == MatType.CV_32SC4)
            //   return RGBLuminanceSource.BitmapFormat.Prgba64;

            //if (type == MatType.CV_32FC1)
            //   return RGBLuminanceSource.BitmapFormat.Gray32Float;
            //if (type == MatType.CV_32FC3)
            //   return RGBLuminanceSource.BitmapFormat.Rgb128Float;
            //if (type == MatType.CV_32FC4)
            //   return RGBLuminanceSource.BitmapFormat.Rgba128Float;

            throw new ArgumentOutOfRangeException(type.GetType().Name, "Not supported MatType");
        }