Image Formats
- group NVCV_CPP_CORE_IMAGETYPE
Represents the format of an image, encapsulating various properties like data kind, memory layout, color spec, etc.
The
ImageFormat
class is a comprehensive representation of how image data is organized in memory, including its data type, layout, and color information. This format is crucial when processing or manipulating images, as it provides the necessary metadata for correct interpretation of the image data.Functions
-
inline std::ostream &operator<<(std::ostream &out, ImageFormat fmt)
-
inline bool HasSameDataLayout(ImageFormat a, ImageFormat b)
-
constexpr ImageFormat()
-
explicit constexpr ImageFormat(NVCVImageFormat format)
Constructor that initializes from a native format representation.
- Parameters:
format – The native format to initialize from.
-
inline ImageFormat(ColorSpec colorSpec, ChromaSubsampling chromaSub, MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED, const ExtraChannelInfo *exChannelInfo = 0)
Constructs an
ImageFormat
using the provided parameters.- Parameters:
colorSpec – Specification of the color.
chromaSub – Chroma subsampling information.
memLayout – Memory layout type.
dataKind – Kind of data (e.g., float, integer).
swizzle – Channel swizzling information.
packing0 – Primary packing format.
packing1 – Secondary packing format (optional).
packing2 – Tertiary packing format (optional).
packing3 – Quaternary packing format (optional).
-
static constexpr ImageFormat ConstCreate(ColorSpec colorSpec, ChromaSubsampling chromaSub, MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED)
Const versions of
ImageFormat
using the provided parameters.
-
inline ImageFormat(ColorModel colorModel, ColorSpec colorSpec, MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED, const ExtraChannelInfo *exChannelInfo = 0)
Constructs an
ImageFormat
using the provided parameters.- Parameters:
colorModel – Model of the color representation (e.g., RGB, YUV).
colorSpec – Specification of the color.
memLayout – Memory layout type.
dataKind – Kind of data (e.g., float, integer).
swizzle – Channel swizzling information.
packing0 – Primary packing format.
packing1 – Secondary packing format (optional).
packing2 – Tertiary packing format (optional).
packing3 – Quaternary packing format (optional).
-
static constexpr ImageFormat ConstCreate(ColorModel colorModel, ColorSpec colorSpec, MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED)
-
inline ImageFormat(MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED, const ExtraChannelInfo *exChannelInfo = 0)
Constructs an
ImageFormat
using the given memory layout, data kind, swizzle, and packing parameters.- Parameters:
memLayout – Memory layout type.
dataKind – Kind of data (e.g., float, integer).
swizzle – Channel swizzling information.
packing0 – Primary packing format.
packing1 – Secondary packing format (optional).
packing2 – Tertiary packing format (optional).
packing3 – Quaternary packing format (optional).
-
static constexpr ImageFormat ConstCreate(MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED)
-
inline ImageFormat(RawPattern rawPattern, MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED, const ExtraChannelInfo *exChannelInfo = 0)
Constructs an
ImageFormat
using a raw pattern along with other parameters.- Parameters:
rawPattern – Pattern of raw data.
memLayout – Memory layout type.
dataKind – Kind of data (e.g., float, integer).
swizzle – Channel swizzling information.
packing0 – Primary packing format.
packing1 – Secondary packing format (optional).
packing2 – Tertiary packing format (optional).
packing3 – Quaternary packing format (optional).
-
static constexpr ImageFormat ConstCreate(RawPattern rawPattern, MemLayout memLayout, DataKind dataKind, Swizzle swizzle, Packing packing0, Packing packing1 = Packing::NONE, Packing packing2 = Packing::NONE, Packing packing3 = Packing::NONE, AlphaType alphaType = AlphaType::ASSOCIATED)
-
static inline ImageFormat FromFourCC(uint32_t fourcc, ColorSpec colorSpec, MemLayout memLayout)
Creates an
ImageFormat
from a given FourCC code and other parameters.- Parameters:
fourcc – The FourCC code representing the format.
colorSpec – Specification of the color.
memLayout – Memory layout type.
- Returns:
An
ImageFormat
object constructed from the FourCC code.
-
static inline ImageFormat FromPlanes(ImageFormat plane0, ImageFormat plane1 = {}, ImageFormat plane2 = {}, ImageFormat plane3 = {})
Creates an
ImageFormat
that represents a combination of multiple image planes.- Parameters:
plane0 – Primary image plane format.
plane1 – Secondary image plane format (optional).
plane2 – Tertiary image plane format (optional).
plane3 – Quaternary image plane format (optional).
- Returns:
An
ImageFormat
object representing multiple image planes.
-
constexpr operator NVCVImageFormat() const noexcept
-
constexpr NVCVImageFormat cvalue() const noexcept
-
constexpr bool operator==(ImageFormat that) const noexcept
-
constexpr bool operator!=(ImageFormat that) const noexcept
-
inline ImageFormat dataKind(DataKind dataKind) const
-
inline ImageFormat alphaType(AlphaType newAlphaType) const
-
inline ImageFormat extraChannelInfo(const ExtraChannelInfo *newExChannelInfo) const
-
inline void extraChannelInfo(ExtraChannelInfo *exChannelInfo) const noexcept
-
inline ImageFormat memLayout(MemLayout newMemLayout) const
-
inline ImageFormat colorSpec(ColorSpec newColorSpec) const
-
inline ColorSpec colorSpec() const noexcept
-
inline ImageFormat chromaSubsampling(ChromaSubsampling css) const
-
inline ChromaSubsampling chromaSubsampling() const noexcept
-
inline ImageFormat rawPattern(RawPattern newRawPattern) const
-
inline RawPattern rawPattern() const noexcept
-
inline ColorModel colorModel() const noexcept
-
inline uint32_t fourCC() const
-
inline ImageFormat swizzleAndPacking(Swizzle newSwizzle, Packing newPacking0, Packing newPacking1, Packing newPacking2, Packing newPacking3) const
-
inline ImageFormat planeFormat(int32_t plane) const noexcept
-
class ImageFormat
- #include <ImageFormat.hpp>
-
inline std::ostream &operator<<(std::ostream &out, ImageFormat fmt)