/// <summary> /// Get the depth type of the image /// </summary> /// <param name="image">The image to apply reflection on</param> /// <returns>The depth type of the image</returns> public static Type GetTypeOfDepth(IImage image) { Type baseType = Toolbox.GetBaseType(image.GetType(), "Image`2") ?? Toolbox.GetBaseType(image.GetType(), "CudaImage`2"); if (baseType != null) { return(baseType.GetGenericArguments()[1]); } else { using (InputArray iaImage = image.GetInputArray()) { return(CvInvoke.GetDepthType(iaImage.GetDepth())); } //baseType = Toolbox.GetBaseType(image.GetType(), "Mat"); //return //baseType == null ? null : //CvInvoke.GetDepthType((image as Mat).Depth); } }