次の方法で共有


Windows App SDK での AI イメージングの API リファレンス

重要

Windows App SDK の最新の 試験的チャネル リリースで使用できます。

Windows App SDK の実験用チャネルには、開発の初期段階の API と機能が含まれています。 実験用チャネル内のすべての API は、広範な変更と破壊的変更の対象となり、今後のリリースからいつでも削除される可能性があります。 試験段階の機能は運用環境での使用はサポートされておらず、使用するアプリは Microsoft Store に公開できません。

  • イメージング機能は中国では使用できません。
  • パッケージ化されていないアプリはサポートされていません。

次の機能をサポートする人工知能 (AI) によってサポートされる windows App SDK イメージング API について説明します。

  • イメージの超解像度: 画像のスケーリングとシャープニング
  • イメージの説明: 画像を説明するテキストを生成します
  • 画像セグメント化: 画像内のオブジェクトを識別する

詳細については、「get started with AI imaging in the Windows アプリ SDK」を参照してください。

ヒント

これらの API とその機能に関するフィードバックを提供するには、Windows App SDK GitHub リポジトリに 新しいイシュー を作成するか (タイトルに Imaging を含める)、または既存の問題 に応答します。


Microsoft.Graphics.Imaging 名前空間

画像のスケーリングとシャープ化を行う機械学習モデルの API を提供します。

ImageBuffer クラス

public sealed class ImageBuffer : System.IDisposable

効率的なクロスプロセス マーシャリングのための非圧縮ビットマップを表します。

なし

ImageBuffer は、画像データを必要とする TextRecognizer などの AI モデル API で使用できます。 一般的な使用方法には、既存の SoftwareBitmap から ImageBuffer を作成する必要があります。

ImageBuffer.Buffer プロパティ

public Windows.Storage.Streams.IBuffer Buffer { get; }

現在のイメージ バッファーを取得します。

プロパティ値

現在の画像バッファー。

ImageBuffer.BufferLength プロパティ

public uint BufferLength { get; }

イメージ バッファーの長さを取得します。

プロパティ値

イメージ バッファーの長さ。

ImageBuffer.Close メソッド

// This member is not implemented in C#

オブジェクトと関連付けられているリソースを破棄します。

なし

C# では実装されていません。

ImageBuffer.CopyToBuffer(System.Byte[]) メソッド

public void CopyToBuffer (byte[] values);

指定されたターゲット バッファーに現在のバッファーをコピーします。

パラメーター
values

バッファー内のバイトのベクトル。

ImageBuffer.CreateBufferAttachedToBitmap(Windows.Graphics.Imaging.SoftwareBitmap) メソッド

public static Microsoft.Graphics.Imaging.ImageBuffer CreateBufferAttachedToBitmap (Windows.Graphics.Imaging.SoftwareBitmap softwareBitmap);

ビットマップ オブジェクトから IMemoryBufferReference を取得して、既存の SotftwareBitmap から新しい ImageBuffer を作成します。

パラメーター
ソフトウェアビットマップ

ImageBuffer の作成に使用する SotftwareBitmap。

戻り値

サポートされていない形式の場合は ImageBuffer または null。

なし

SoftwareBitmap は、非同期操作が完了し、新しい ImageBuffer が破棄されるまでロックされます。

ImageBuffer.CreateCopyFromBitmap(Windows.Graphics.Imaging.SoftwareBitmap) メソッド

public static Microsoft.Graphics.Imaging.ImageBuffer CreateCopyFromBitmap (Windows.Graphics.Imaging.SoftwareBitmap softwareBitmap);

基になるビットマップ データをコピーして、既存の SotftwareBitmap から新しい ImageBuffer を作成します。

パラメーター
ソフトウェアビットマップ

ImageBuffer の作成に使用する SotftwareBitmap。

戻り値

サポートされていない形式の場合は ImageBuffer または null。

なし

SoftwareBitmap は、非同期操作が完了し、新しい ImageBuffer が破棄されるまでロックされます。

ImageBuffer.CreateFromBuffer(Windows.Storage.Streams.IBuffer,Microsoft.Graphics.Imaging.PixelFormat,System.UInt32,System.UInt32) メソッド

public static Microsoft.Graphics.Imaging.ImageBuffer CreateFromBuffer (Windows.Storage.Streams.IBuffer buffer, Microsoft.Graphics.Imaging.PixelFormat pixelFormat, uint width, uint height);
パラメーター
buffer
pixelFormat
width
height
戻り値

ImageBuffer.CreateFromBufferWithStride(Windows.Storage.Streams.IBuffer,Microsoft.Graphics.Imaging.PixelFormat,System.UInt32,System.UInt32,System.UInt32) メソッド

public static Microsoft.Graphics.Imaging.ImageBuffer CreateFromBufferWithStride (Windows.Storage.Streams.IBuffer buffer, Microsoft.Graphics.Imaging.PixelFormat pixelFormat, uint width, uint height, uint stride);
パラメーター
buffer
ピクセルフォーマット
width
height
stride
戻り値

ImageBuffer.CreateSoftwareBitmap メソッド

public Windows.Graphics.Imaging.SoftwareBitmap CreateSoftwareBitmap ();

ImageBuffer に格納されているピクセル データから、ピクセル タイプ BGRA32 の新しい SoftwareBitmap を作成します。

戻り値

ピクセル タイプ BGRA32 の新しい SoftwareBitmap。

ImageBuffer.Height プロパティ

public uint Height { get; }

イメージの高さをピクセル単位で取得します。

プロパティ値

画像の高さ (ピクセル単位)。

ImageBuffer.#ctor(Windows.Storage.Streams.IBuffer,Microsoft.Graphics.Imaging.PixelFormat,System.UInt32,System.UInt32) コンストラクター

public ImageBuffer (Windows.Storage.Streams.IBuffer buffer, Microsoft.Graphics.Imaging.PixelFormat pixelFormat, uint width, uint height);

ImageBuffer クラスの新しいインスタンスを初期化します。

パラメーター
buffer

ImageBuffer。

ピクセルフォーマット

画像のピクセル形式。

width

イメージの幅 (ピクセル単位)。

height

画像の高さ (ピクセル単位)。

ImageBuffer.PixelFormat プロパティ

public Microsoft.Graphics.Imaging.PixelFormat PixelFormat { get; }

イメージのピクセル形式を取得します。

プロパティ値

画像のピクセル形式。

ImageBuffer.Width プロパティ

public uint Width { get; }

イメージの幅をピクセル単位で取得します。

プロパティ値

イメージの幅 (ピクセル単位)。

ImageObjectExtractor クラス

public sealed class ImageObjectExtractor : System.IDisposable

ImageObjectExtractor.Close メソッド

// This member is not implemented in C#
なし

C# では実装されていません。

ImageObjectExtractor.CreateWithImageBufferAsync(Microsoft.Graphics.Imaging.ImageBuffer) メソッド

public static Windows.Foundation.IAsyncOperation<Microsoft.Graphics.Imaging.ImageObjectExtractor> CreateWithImageBufferAsync (Microsoft.Graphics.Imaging.ImageBuffer imageBuffer);
パラメーター
イメージバッファ
戻り値

ImageObjectExtractor.CreateWithSoftwareBitmapAsync(Windows.Graphics.Imaging.SoftwareBitmap) メソッド

public static Windows.Foundation.IAsyncOperation<Microsoft.Graphics.Imaging.ImageObjectExtractor> CreateWithSoftwareBitmapAsync (Windows.Graphics.Imaging.SoftwareBitmap softwareBitmap);
パラメーター
ソフトウェアビットマップ
戻り値

ImageObjectExtractor.GetImageBufferObjectMask(Microsoft.Graphics.Imaging.ImageObjectExtractorHint) メソッド

public Microsoft.Graphics.Imaging.ImageBuffer GetImageBufferObjectMask (Microsoft.Graphics.Imaging.ImageObjectExtractorHint hint);
パラメーター
ヒント (hint)
戻り値

ImageObjectExtractor.GetSoftwareBitmapObjectMask(Microsoft.Graphics.Imaging.ImageObjectExtractorHint) メソッド

public Windows.Graphics.Imaging.SoftwareBitmap GetSoftwareBitmapObjectMask (Microsoft.Graphics.Imaging.ImageObjectExtractorHint hint);
パラメーター
ヒント (hint)
戻り値

ImageObjectExtractor.IsAvailable メソッド

public static bool IsAvailable ();
戻り値

ImageObjectExtractor.MakeAvailableAsync メソッド

public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
戻り値

ImageObjectExtractorHint クラス

public sealed class ImageObjectExtractorHint

ImageObjectExtractorHint.ExcludePoints プロパティ

public System.Collections.Generic.IReadOnlyList<Windows.Graphics.PointInt32> ExcludePoints { get; }
プロパティ値

ImageObjectExtractorHint.#ctor(Windows.Foundation.Collections.IVector{Windows.Graphics.RectInt32},Windows.Foundation.Collections.IVector{Windows.Graphics.PointInt32},Windows.Foundation.Collections.IVector{Windows.Graphics.PointInt32}) コンストラクター

public ImageObjectExtractorHint (System.Collections.Generic.IList<Windows.Graphics.RectInt32> includeRects, System.Collections.Generic.IList<Windows.Graphics.PointInt32> includePoints, System.Collections.Generic.IList<Windows.Graphics.PointInt32> excludePoints);
パラメーター
includeRects
ポイントを含める
excludePoints

ImageObjectExtractorHint.IncludePoints プロパティ

public System.Collections.Generic.IReadOnlyList<Windows.Graphics.PointInt32> IncludePoints { get; }
プロパティ値

ImageObjectExtractorHint.IncludeRects プロパティ

public System.Collections.Generic.IReadOnlyList<Windows.Graphics.RectInt32> IncludeRects { get; }
プロパティ値

ImageScaler クラス

public sealed class ImageScaler : System.IDisposable

ImageScaler.Close メソッド

// This member is not implemented in C#
なし

C# では実装されていません。

ImageScaler.CreateAsync メソッド

public static Windows.Foundation.IAsyncOperation<Microsoft.Graphics.Imaging.ImageScaler> CreateAsync ();
戻り値

ImageScaler.IsAvailable メソッド

public static bool IsAvailable ();
戻り値

ImageScaler.MakeAvailableAsync メソッド

public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
戻り値

ImageScaler.MaxSupportedScaleFactor プロパティ

public int MaxSupportedScaleFactor { get; }
プロパティ値

ImageScaler.ScaleImageBuffer(Microsoft.Graphics.Imaging.ImageBuffer,System.Int32,System.Int32) メソッド

public Microsoft.Graphics.Imaging.ImageBuffer ScaleImageBuffer (Microsoft.Graphics.Imaging.ImageBuffer imageBuffer, int width, int height);
パラメーター
イメージバッファ
width
height
戻り値

ImageScaler.ScaleSoftwareBitmap(Windows.Graphics.Imaging.SoftwareBitmap,System.Int32,System.Int32) メソッド

public Windows.Graphics.Imaging.SoftwareBitmap ScaleSoftwareBitmap (Windows.Graphics.Imaging.SoftwareBitmap softwareBitmap, int width, int height);
パラメーター
ソフトウェアビットマップ
width
height
戻り値

PixelFormat 列挙型

public enum PixelFormat

基になるビットマップ データのバイナリ レイアウトの種類を指定します。

列挙型フィールド
未定義: 0

バイナリ形式は未定義です。

Rgb24: 1

バイナリ形式はピクセルあたり 24 ビットです。赤、緑、青の各コンポーネントには、それぞれ 8 ビットが使用されます。

Argb32: 2

1 ピクセルあたり 32 ビットのバイナリ形式。アルファ、赤、緑、青の各コンポーネントには、それぞれ 8 ビットが使用されます。

Rgba32: 3

バイナリ形式はピクセルあたり 32 ビットです。各 8 ビットは、赤、緑、青、アルファの各コンポーネントに使用されます。 カラー コンポーネントは、赤、緑、青、アルファの順に格納されます。

Bgra32: 4

バイナリ形式はピクセルあたり 32 ビットです。それぞれ 8 ビットが、青、緑、赤、アルファの各コンポーネントに使用されます。 カラー コンポーネントは、青、緑、赤、アルファの順に格納されます。

Gray8: 5

バイナリ形式は、ピクセルあたり 16 ビットです。 色情報は、65536のグレーの色合いを指定します。