ImageVariableDescriptorPreview.BitmapPixelFormat 属性

定义

已弃用。 获取图像的像素格式。

public:
 property BitmapPixelFormat BitmapPixelFormat { BitmapPixelFormat get(); };
BitmapPixelFormat BitmapPixelFormat();
/// [get: Windows.Foundation.Metadata.Deprecated("Use IImageFeatureDescriptor instead of IImageVariableDescriptorPreview. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")]
BitmapPixelFormat BitmapPixelFormat();
public BitmapPixelFormat BitmapPixelFormat { get; }
public BitmapPixelFormat BitmapPixelFormat { [Windows.Foundation.Metadata.Deprecated("Use IImageFeatureDescriptor instead of IImageVariableDescriptorPreview. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")] get; }
var bitmapPixelFormat = imageVariableDescriptorPreview.bitmapPixelFormat;
Public ReadOnly Property BitmapPixelFormat As BitmapPixelFormat

属性值

图像的像素格式。

属性

示例

public void Evaluator(LearningModelPreview model)
{
	// Retrieve the first input feature which is an image
    ILearningModelVariableDescriptorPreview inputImageFeatureDescription = model.Description.InputFeatures.FirstOrDefault(feature=>feature.ModelFeatureKind == LearningModelFeatureKindPreview.Image);

    ImageVariableDescriptorPreview imageDescriptor = (ImageVariableDescriptorPreview)inputImageFeatureDescription;

	// Ensure the input feature handles the format RGBA8
    if (imageDescriptor.BitmapPixelFormat != BitmapPixelFormat.Rgba8)
    {
        Console.WriteLine($"Input Feature Name: {imageDescriptor.Name}. Format not supported.");
    }

 }

注解

警告

这是一个已弃用的 API。 请改用 Windows.AI.MachineLearning 命名空间。

适用于