74 references to MLPixelFormat
Microsoft.ML.ImageAnalytics (13)
ImagePixelExtractor.cs (2)
368
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
369
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
MLImage.cs (10)
23
private
MLPixelFormat
_pixelFormat;
81
public static unsafe MLImage CreateFromPixels(int width, int height,
MLPixelFormat
pixelFormat, ReadOnlySpan<byte> imagePixelData)
83
if (pixelFormat !=
MLPixelFormat
.Bgra32 && pixelFormat !=
MLPixelFormat
.Rgba32)
103
SKBitmap image = new SKBitmap(new SKImageInfo(width, height, pixelFormat ==
MLPixelFormat
.Bgra32 ? SKColorType.Bgra8888 : SKColorType.Rgba8888));
116
public
MLPixelFormat
PixelFormat
267
SKColorType.Bgra8888 =>
MLPixelFormat
.Bgra32,
268
SKColorType.Rgba8888 =>
MLPixelFormat
.Rgba32,
273
private
MLPixelFormat
CloneImageToSupportedFormat()
285
return
MLPixelFormat
.Bgra32;
VectorToImageTransform.cs (1)
418
dst = MLImage.CreateFromPixels(width, height,
MLPixelFormat
.Bgra32, imageData);
Microsoft.ML.OnnxTransformerTest (1)
OnnxTransformTests.cs (1)
616
Image = MLImage.CreateFromPixels(Width, Height,
MLPixelFormat
.Bgra32, imageData);
Microsoft.ML.Samples (6)
Dynamic\Transforms\ApplyONNXModelWithInMemoryImages.cs (1)
118
Image = MLImage.CreateFromPixels(width, height,
MLPixelFormat
.Bgra32, imageData);
Dynamic\Transforms\ImageAnalytics\ConvertToGrayScaleInMemory.cs (5)
45
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
46
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
53
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
54
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
110
Image = MLImage.CreateFromPixels(width, height,
MLPixelFormat
.Bgra32, imageData);
Microsoft.ML.Tests (54)
ImagesTests.cs (54)
213
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
214
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
263
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
264
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
286
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
287
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
325
Image = MLImage.CreateFromPixels(width, height,
MLPixelFormat
.Bgra32, imageData);
378
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
379
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
386
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
387
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
453
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
454
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
461
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
462
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
529
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
530
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
537
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
538
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
604
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
605
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
612
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
613
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
679
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
680
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
687
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
688
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
755
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
756
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
763
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
764
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
830
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
831
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
838
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
839
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
906
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
907
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
914
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
915
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
980
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
981
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
988
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
989
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
1033
MLPixelFormat
.Bgra32 => (3, 2, 1, 0),
1034
MLPixelFormat
.Rgba32 => (3, 0, 1, 2),
1246
Assert.True(image1.PixelFormat ==
MLPixelFormat
.Rgba32 || image1.PixelFormat ==
MLPixelFormat
.Bgra32);
1268
Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10,
MLPixelFormat
.Unknown, Array.Empty<byte>()));
1269
Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10,
MLPixelFormat
.Bgra32, Array.Empty<byte>()));
1270
Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(0, 10,
MLPixelFormat
.Bgra32, new byte[10]));
1271
Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 0,
MLPixelFormat
.Bgra32, new byte[10]));
1272
Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10,
MLPixelFormat
.Bgra32, new byte[401]));
1309
MLImage image = MLImage.CreateFromPixels(10, 10,
MLPixelFormat
.Bgra32, new byte[10 * 10 * 4]);
1315
Assert.Equal(
MLPixelFormat
.Bgra32, image.PixelFormat);