Partager via


Référence d’API pour l’acquisition d’images IA dans le Kit de développement logiciel (SDK) d’application Windows

Important

Disponible dans la dernière version de la chaîne expérimentale du SDK d'applications Windows.

Le canal expérimental du Kit de développement logiciel (SDK) d’application Windows inclut des API et des fonctionnalités au début du développement. Toutes les API du canal expérimental font l’objet de révisions approfondies et de changements cassants et peuvent être supprimées des versions ultérieures à tout moment. Les fonctionnalités expérimentales ne sont pas prises en charge pour une utilisation dans les environnements de production et les applications qui les utilisent ne peuvent pas être publiées dans le Microsoft Store.

  • Les fonctionnalités d’imagerie ne sont pas disponibles en Chine.
  • Les applications non empaquetées ne sont pas prises en charge.

Découvrez les API d'imagerie du SDK d'applications Windows, soutenues par l'intelligence artificielle (IA), qui prennent en charge les capacités suivantes :

  • Super résolution d'image : mise à l'échelle et amélioration de la netteté des images
  • Description de l’image: production de texte décrivant l’image
  • segmentation d’image : identification d’objets au sein d’une image

Pour plus d’informations, consultez Prise en main de l’imagerie IA dans le Kit de développement logiciel (SDK) d’application Windows.

Conseil

Fournissez des commentaires sur ces API et leurs fonctionnalités en créant un nouveau problème dans le dépôt GitHub du Kit de développement logiciel (SDK) d’application Windows (inclure Imaging dans le titre) ou en répondant à un problème existant.


Espace de noms Microsoft.Graphics.Imaging

Fournit des API pour les modèles Machine Learning qui scale-and-sharpen images.

Classe ImageBuffer

public sealed class ImageBuffer : System.IDisposable

Représente un bitmap non compressé pour un marshaling inter-processus efficace.

Remarques

ImageBuffer peut être utilisé avec des API de modèles d’IA telles que TextRecognizer qui nécessitent des données d’image. L’utilisation classique consiste à créer un ImageBuffer à partir d’un SoftwareBitmap existant.

ImageBuffer.Buffer property

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

Obtient le tampon d'image actuel.

Valeur de propriété

La mémoire tampon de l'image actuelle.

Propriété ImageBuffer.BufferLength

public uint BufferLength { get; }

Renvoie la longueur de l’ImageBuffer.

Valeur de propriété

La longueur de l’ImageBuffer.

Méthode ImageBuffer.Close

// This member is not implemented in C#

Libère l’objet et ses ressources associées.

Remarques

Non implémenté en C#.

Méthode ImageBuffer.CopyToBuffer(System.Byte[])

public void CopyToBuffer (byte[] values);

Copie le tampon actuel dans le tampon cible fourni.

Paramètres
values

Vecteur d'octets dans le tampon.

Méthode ImageBuffer.CreateBufferAttachedToBitmap(Windows.Graphics.Imaging.SoftwareBitmap)

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

Créer un nouveau ImageBuffer à partir d'un SotftwareBitmap existant en obtenant une IMemoryBufferReference de l'objet bitmap.

Paramètres
softwareBitmap

Le SotftwareBitmap à partir duquel le ImageBuffer est créé.

Retours

L’ImageBuffer ou null s’il s’agit d’un format non pris en charge.

Remarques

Le SoftwareBitmap est verrouillé jusqu’à ce que l’opération asynchrone se termine et que le nouvel ImageBuffer soit détruit.

Méthode ImageBuffer.CreateCopyFromBitmap(Windows.Graphics.Imaging.SoftwareBitmap)

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

Crée un nouvel ImageBuffer à partir d’un SoftwareBitmap existant en copiant les données sous-jacentes du bitmap.

Paramètres
softwareBitmap

Le SotftwareBitmap à partir duquel le ImageBuffer est créé.

Retours

L’ImageBuffer ou null s’il s’agit d’un format non pris en charge.

Remarques

Le SoftwareBitmap est verrouillé jusqu’à ce que l’opération asynchrone se termine et que le nouvel ImageBuffer soit détruit.

Méthode 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);
Paramètres
buffer
pixelFormat
largeur
hauteur
Retours

Méthode 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);
Paramètres
buffer
pixelFormat
largeur
hauteur
stride
Retours

Méthode ImageBuffer.CreateSoftwareBitmap

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

Crée un nouveau SoftwareBitmap de type de pixel BGRA32 à partir des données de pixel stockées dans un ImageBuffer.

Retours

Le nouveau SoftwareBitmap de type BGRA32.

ImageBuffer.Height property

public uint Height { get; }

Renvoie la hauteur de l’image, en pixels.

Valeur de propriété

La hauteur de l’image, en pixels.

ImageBuffer.#ctor(Windows.Storage.Streams.IBuffer,Microsoft.Graphics.Imaging.PixelFormat,System.UInt32,System.UInt32) constructor

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

Initialise une nouvelle instance de la classe ImageBuffer.

Paramètres
buffer

L’ImageBuffer.

pixelFormat

Le format de pixel de l’image.

largeur

La largeur de l’image, en pixels.

hauteur

La hauteur de l’image, en pixels.

Propriété ImageBuffer.PixelFormat

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

Renvoie le format de pixel de l’image.

Valeur de propriété

Le format de pixel de l’image.

Propriété ImageBuffer.Width

public uint Width { get; }

Renvoie la largeur de l’image, en pixels.

Valeur de propriété

La largeur de l’image, en pixels.

Classe ImageObjectExtractor

public sealed class ImageObjectExtractor : System.IDisposable

Méthode ImageObjectExtractor.Close

// This member is not implemented in C#
Remarques

Non implémenté en C#.

Méthode ImageObjectExtractor.CreateWithImageBufferAsync(Microsoft.Graphics.Imaging.ImageBuffer)

public static Windows.Foundation.IAsyncOperation<Microsoft.Graphics.Imaging.ImageObjectExtractor> CreateWithImageBufferAsync (Microsoft.Graphics.Imaging.ImageBuffer imageBuffer);
Paramètres
imageBuffer
Retours

Méthode ImageObjectExtractor.CreateWithSoftwareBitmapAsync(Windows.Graphics.Imaging.SoftwareBitmap)

public static Windows.Foundation.IAsyncOperation<Microsoft.Graphics.Imaging.ImageObjectExtractor> CreateWithSoftwareBitmapAsync (Windows.Graphics.Imaging.SoftwareBitmap softwareBitmap);
Paramètres
softwareBitmap
Retours

Méthode ImageObjectExtractor.GetImageBufferObjectMask(Microsoft.Graphics.Imaging.ImageObjectExtractorHint)

public Microsoft.Graphics.Imaging.ImageBuffer GetImageBufferObjectMask (Microsoft.Graphics.Imaging.ImageObjectExtractorHint hint);
Paramètres
hint
Retours

Méthode ImageObjectExtractor.GetSoftwareBitmapObjectMask(Microsoft.Graphics.Imaging.ImageObjectExtractorHint)

public Windows.Graphics.Imaging.SoftwareBitmap GetSoftwareBitmapObjectMask (Microsoft.Graphics.Imaging.ImageObjectExtractorHint hint);
Paramètres
hint
Retours

Méthode ImageObjectExtractor.IsAvailable

public static bool IsAvailable ();
Retours

Méthode ImageObjectExtractor.MakeAvailableAsync

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

Classe ImageObjectExtractorHint

public sealed class ImageObjectExtractorHint

propriété ImageObjectExtractorHint.ExcludePoints

public System.Collections.Generic.IReadOnlyList<Windows.Graphics.PointInt32> ExcludePoints { get; }
Valeur de propriété

ImageObjectExtractorHint.#ctor(Windows.Foundation.Collections.IVector{Windows.Graphics.RectInt32},Windows.Foundation.Collections.IVector{Windows.Graphics.PointInt32},Windows.Foundation.Collections.IVector{Windows.Graphics.PointInt32}) constructor

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);
Paramètres
includeRects
includePoints
excludePoints

Propriété ImageObjectExtractorHint.IncludePoints

public System.Collections.Generic.IReadOnlyList<Windows.Graphics.PointInt32> IncludePoints { get; }
Valeur de propriété

Propriété ImageObjectExtractorHint.IncludeRects

public System.Collections.Generic.IReadOnlyList<Windows.Graphics.RectInt32> IncludeRects { get; }
Valeur de propriété

Classe ImageScaler

public sealed class ImageScaler : System.IDisposable

Méthode ImageScaler.Close

// This member is not implemented in C#
Remarques

Non implémenté en C#.

Méthode ImageScaler.CreateAsync

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

Méthode ImageScaler.IsAvailable

public static bool IsAvailable ();
Retours

Méthode ImageScaler.MakeAvailableAsync

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

Propriété ImageScaler.MaxSupportedScaleFactor

public int MaxSupportedScaleFactor { get; }
Valeur de propriété

Méthode 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);
Paramètres
imageBuffer
largeur
hauteur
Retours

Méthode 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);
Paramètres
softwareBitmap
largeur
hauteur
Retours

PixelFormat enum

public enum PixelFormat

Spécifie les types de dispositions binaires pour les données du bitmap sous-jacent.

Champs d'énumération
Indéfini : 0

Le format binaire est indéfini.

Rgb24 : 1

Le format binaire est de 24 bits par pixel ; 8 bits sont utilisés pour les composants rouge, vert et bleu.

Argb32 : 2

Le format binaire est de 32 bits par pixel ; 8 bits sont utilisés pour les composants alpha, rouge, vert et bleu.

Rgba32 : 3

Le format binaire est de 32 bits par pixel ; 8 bits sont utilisés pour les composants rouge, vert, bleu et alpha. Les composants de couleur sont stockés dans l’ordre rouge, vert, bleu et alpha.

Bgra32 : 4

Le format binaire est de 32 bits par pixel ; 8 bits sont utilisés pour les composants bleu, vert, rouge et alpha. Les composants de couleur sont stockés dans l’ordre bleu, vert, rouge et alpha.

Gray8 : 5

Le format binaire est de 16 bits par pixel. Les informations de couleur spécifient 65536 nuances de gris.