Class ImageFormatConverter

Namespace
NT2I.ONNX.DataHandling.Cpu.Features
Assembly
NT2I.ONNX.DataHandling.Cpu.dll

Fournit des fonctions pour convertir les formats d'images entrelacés (packed) et planaires (planar).

public static class ImageFormatConverter
Inheritance
ImageFormatConverter
Inherited Members

Methods

PackedRGBToBGR(byte[], int, int)

Convertit une image entrelacée RGB en BGR.

public static void PackedRGBToBGR(byte[] image, int wim, int him)

Parameters

image byte[]

Tableau de bytes représentant l'image entrelacée.

wim int

Largeur de l'image.

him int

Hauteur de l'image.

PackedToPlanar(ReadOnlySpan<byte>, Span<byte>, bool)

Convertit une image au format "packed" (entrelacé) RGBRGB... en format "planar". Le format de sortie peut être RRR...GGG...BBB... ou BBB...GGG...RRR... Cette version est hautement optimisée en utilisant des pointeurs pour un accès mémoire direct.

public static void PackedToPlanar(ReadOnlySpan<byte> imageIn, Span<byte> imageOut, bool invert = false)

Parameters

imageIn ReadOnlySpan<byte>

Span du buffer source (RGB entrelacé).

imageOut Span<byte>

Span du buffer de destination (planaire).

invert bool

Si true, l'ordre des canaux en sortie sera BGR. Sinon, ce sera RGB.

PackedToPlanar(ReadOnlySpan<byte>, Span<byte>, Span<byte>, Span<byte>)

Convertit une image BGR entrelacée (packed) en trois canaux planaires (B, G, R). Cette version optimisée utilise des Spans pour une performance maximale et zéro-allocation.

public static void PackedToPlanar(ReadOnlySpan<byte> packedBGR, Span<byte> b, Span<byte> g, Span<byte> r)

Parameters

packedBGR ReadOnlySpan<byte>

Le buffer source au format [B, G, R, B, G, R, ...]

b Span<byte>

Le Span de destination pour le canal Bleu.

g Span<byte>

Le Span de destination pour le canal Vert.

r Span<byte>

Le Span de destination pour le canal Rouge.

PackedToPlanarRGB(byte[], byte[], byte[], byte[], int, int)

Convertit une image entrelacée RGB en format planaire en utilisant des canaux séparés.

public static void PackedToPlanarRGB(byte[] imageIn, byte[] R, byte[] G, byte[] B, int wim, int him)

Parameters

imageIn byte[]
R byte[]
G byte[]
B byte[]
wim int
him int

PackedToPlanarRGB(byte[], byte[], int, int)

Convertit une image entrelacée RGB en format planaire.

public static void PackedToPlanarRGB(byte[] imageIn, byte[] imageOut, int wim, int him)

Parameters

imageIn byte[]

Tableau de bytes représentant l'image entrelacée.

imageOut byte[]

Tableau de bytes représentant l'image planaire.

wim int

Largeur de l'image.

him int

Hauteur de l'image.

PackedToPlanarRGB(byte[], int, int)

Convertit une image entrelacée RGB en format planaire et retourne le résultat.

public static byte[] PackedToPlanarRGB(byte[] imageIn, int wim, int him)

Parameters

imageIn byte[]
wim int
him int

Returns

byte[]

PlanarRGBToBGR(byte[], int, int)

Convertit une image planaire RGB en BGR.

public static void PlanarRGBToBGR(byte[] image, int wim, int him)

Parameters

image byte[]

Tableau de bytes représentant l'image planaire.

wim int

Largeur de l'image.

him int

Hauteur de l'image.

PlanarToPackedRGB(byte[], byte[], byte[], byte[], int, int)

Convertit une image planaire RGB en format entrelacé en utilisant des canaux séparés.

public static void PlanarToPackedRGB(byte[] R, byte[] G, byte[] B, byte[] imageOut, int wim, int him)

Parameters

R byte[]

Canal Rouge.

G byte[]

Canal Vert.

B byte[]

Canal Bleu.

imageOut byte[]

Tableau de bytes représentant l'image entrelacée.

wim int

Largeur de l'image.

him int

Hauteur de l'image.

PlanarToPackedRGB(byte[], byte[], int, int)

Convertit une image planaire RGB en format entrelacé.

public static void PlanarToPackedRGB(byte[] imageIn, byte[] imageOut, int wim, int him)

Parameters

imageIn byte[]

Tableau de bytes représentant l'image planaire.

imageOut byte[]

Tableau de bytes représentant l'image entrelacée.

wim int

Largeur de l'image.

him int

Hauteur de l'image.

PlanarToPackedRGB(byte[], int, int)

Convertit une image planaire RGB en format entrelacé et retourne le résultat.

public static byte[] PlanarToPackedRGB(byte[] imageIn, int wim, int him)

Parameters

imageIn byte[]

Tableau de bytes représentant l'image planaire.

wim int

Largeur de l'image.

him int

Hauteur de l'image.

Returns

byte[]

Tableau de bytes représentant l'image entrelacée.