ailia  1.3.0.0
Macros | Functions
ailia_format.h File Reference

AILIA format definition and conversion. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AILIA_API   __stdcall
 
#define AILIA_IMAGE_FORMAT_RGBA   (0x00)
 
#define AILIA_IMAGE_FORMAT_BGRA   (0x01)
 
#define AILIA_IMAGE_FORMAT_RGB   (0x02)
 
#define AILIA_IMAGE_FORMAT_BGR   (0x03)
 
#define AILIA_IMAGE_FORMAT_RGBA_B2T   (0x10)
 
#define AILIA_IMAGE_FORMAT_BGRA_B2T   (0x11)
 
#define AILIA_NETWORK_IMAGE_FORMAT_BGR   (0)
 
#define AILIA_NETWORK_IMAGE_FORMAT_RGB   (1)
 
#define AILIA_NETWORK_IMAGE_FORMAT_GRAY   (2)
 
#define AILIA_NETWORK_IMAGE_FORMAT_GRAY_EQUALIZE   (3)
 
#define AILIA_NETWORK_IMAGE_CHANNEL_FIRST   (0)
 
#define AILIA_NETWORK_IMAGE_CHANNEL_LAST   (1)
 
#define AILIA_NETWORK_IMAGE_RANGE_UNSIGNED_INT8   (0)
 
#define AILIA_NETWORK_IMAGE_RANGE_SIGNED_INT8   (1)
 
#define AILIA_NETWORK_IMAGE_RANGE_UNSIGNED_FP32   (2)
 
#define AILIA_NETWORK_IMAGE_RANGE_SIGNED_FP32   (3)
 
#define AILIA_NETWORK_IMAGE_RANGE_IMAGENET   (4)
 

Functions

int AILIA_API ailiaFormatConvert (void *dst, unsigned int dst_width, unsigned int dst_height, unsigned int dst_format, unsigned int dst_channel, unsigned int dst_range, const void *src, int src_stride, unsigned int src_width, unsigned int src_height, unsigned int src_format)
 Converts image formats. More...
 

Detailed Description

AILIA format definition and conversion.

Date
July 28, 2021

Macro Definition Documentation

◆ AILIA_API

#define AILIA_API   __stdcall

◆ AILIA_IMAGE_FORMAT_BGR

#define AILIA_IMAGE_FORMAT_BGR   (0x03)

BGR order

◆ AILIA_IMAGE_FORMAT_BGRA

#define AILIA_IMAGE_FORMAT_BGRA   (0x01)

BGRA order

◆ AILIA_IMAGE_FORMAT_BGRA_B2T

#define AILIA_IMAGE_FORMAT_BGRA_B2T   (0x11)

BGRA order (Bottom to top)

◆ AILIA_IMAGE_FORMAT_RGB

#define AILIA_IMAGE_FORMAT_RGB   (0x02)

RGB order

◆ AILIA_IMAGE_FORMAT_RGBA

#define AILIA_IMAGE_FORMAT_RGBA   (0x00)

RGBA order

◆ AILIA_IMAGE_FORMAT_RGBA_B2T

#define AILIA_IMAGE_FORMAT_RGBA_B2T   (0x10)

RGBA order (Bottom to top)

◆ AILIA_NETWORK_IMAGE_CHANNEL_FIRST

#define AILIA_NETWORK_IMAGE_CHANNEL_FIRST   (0)

DCYX order

◆ AILIA_NETWORK_IMAGE_CHANNEL_LAST

#define AILIA_NETWORK_IMAGE_CHANNEL_LAST   (1)

DYXC order

◆ AILIA_NETWORK_IMAGE_FORMAT_BGR

#define AILIA_NETWORK_IMAGE_FORMAT_BGR   (0)

BGR order

◆ AILIA_NETWORK_IMAGE_FORMAT_GRAY

#define AILIA_NETWORK_IMAGE_FORMAT_GRAY   (2)

Gray Scale (1ch)

◆ AILIA_NETWORK_IMAGE_FORMAT_GRAY_EQUALIZE

#define AILIA_NETWORK_IMAGE_FORMAT_GRAY_EQUALIZE   (3)

Equalized Gray Scale (1ch)

◆ AILIA_NETWORK_IMAGE_FORMAT_RGB

#define AILIA_NETWORK_IMAGE_FORMAT_RGB   (1)

RGB order

◆ AILIA_NETWORK_IMAGE_RANGE_IMAGENET

#define AILIA_NETWORK_IMAGE_RANGE_IMAGENET   (4)

ImageNet mean&std normalize

◆ AILIA_NETWORK_IMAGE_RANGE_SIGNED_FP32

#define AILIA_NETWORK_IMAGE_RANGE_SIGNED_FP32   (3)

-1.0 to 1.0

◆ AILIA_NETWORK_IMAGE_RANGE_SIGNED_INT8

#define AILIA_NETWORK_IMAGE_RANGE_SIGNED_INT8   (1)

-128 to 127

◆ AILIA_NETWORK_IMAGE_RANGE_UNSIGNED_FP32

#define AILIA_NETWORK_IMAGE_RANGE_UNSIGNED_FP32   (2)

0.0 to 1.0

◆ AILIA_NETWORK_IMAGE_RANGE_UNSIGNED_INT8

#define AILIA_NETWORK_IMAGE_RANGE_UNSIGNED_INT8   (0)

0 to 255

Function Documentation

◆ ailiaFormatConvert()

int AILIA_API ailiaFormatConvert ( void *  dst,
unsigned int  dst_width,
unsigned int  dst_height,
unsigned int  dst_format,
unsigned int  dst_channel,
unsigned int  dst_range,
const void *  src,
int  src_stride,
unsigned int  src_width,
unsigned int  src_height,
unsigned int  src_format 
)

Converts image formats.

Parameters
dstThe storage location of the image after conversion (numeric type; a size of sizeof(float)
  • dst_width * dst_height * num_of_channel(See Description) or more must be allocated.)
dst_widthThe width of the image after conversion
dst_heightThe height of the image after conversion
dst_formatThe format of the image after conversion (AILIA_NETWORK_IMAGE_FORMAT_*)
dst_channelThe channel order of the image after conversion (AILIA_NETWORK_IMAGE_CHANNEL_*)
dst_rangeThe range of the image after conversion (AILIA_NETWORK_IMAGE_RANGE_*)
srcThe storage location of the source image (32 bpp)
src_strideThe line byte number of the source image
src_widthThe width of the source image
src_heightThe height of the source image
src_formatThe format of the source image (AILIA_IMAGE_FORMAT_*)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function converts image formats. If dst_format is set to AILIA_NETWORK_IMAGE_FORMAT_BGR or AILIA_NETWORK_IMAGE_FORMAT_RGB , the number of channels is 3, otherwise if set to AILIA_NETWORK_IMAGE_FORMAT_GRAY , the number of channels is 1.