Developer World
Spresense SDK Library v2.2.0-87f81d9
Image Processing Functions

Classes

struct  imageproc_rect_s
 
struct  imageproc_binary_img_s
 
struct  imageproc_imginfo_s
 

Typedefs

typedef struct imageproc_rect_s imageproc_rect_t
 
typedef struct imageproc_binary_img_s imageproc_binary_img_t
 
typedef struct imageproc_imginfo_s imageproc_imginfo_t
 

Enumerations

enum  imageproc_imginfo_e { IMAGEPROC_IMGTYPE_SINGLE = 0, IMAGEPROC_IMGTYPE_BINARY = 1, IMAGEPROC_IMGTYPE_8BPP = 2, IMAGEPROC_IMGTYPE_16BPP = 3 }
 

Functions

void imageproc_initialize (void)
 
void imageproc_finalize (void)
 
void imageproc_convert_yuv2rgb (uint8_t *ibuf, uint32_t hsize, uint32_t vsize)
 
void imageproc_convert_rgb2yuv (uint8_t *ibuf, uint32_t hsize, uint32_t vsize)
 
void imageproc_convert_yuv2gray (uint8_t *ibuf, uint8_t *obuf, size_t hsize, size_t vsize)
 
int imageproc_resize (uint8_t *ibuf, uint16_t ihsize, uint16_t ivsize, uint8_t *obuf, uint16_t ohsize, uint16_t ovsize, int bpp)
 
int imageproc_clip_and_resize (uint8_t *ibuf, uint16_t ihsize, uint16_t ivsize, uint8_t *obuf, uint16_t ohsize, uint16_t ovsize, int bpp, imageproc_rect_t *clip_rect)
 
int imageproc_alpha_blend (imageproc_imginfo_t *dst, int pos_x, int pos_y, imageproc_imginfo_t *src, imageproc_imginfo_t *alpha)
 

Detailed Description

Enumeration Type Documentation

◆ imageproc_imginfo_e

Enumeration of image type

Enumerator
IMAGEPROC_IMGTYPE_SINGLE 

All pixels have the same value

IMAGEPROC_IMGTYPE_BINARY 

Each pixels have 0 or specific non-zero value

IMAGEPROC_IMGTYPE_8BPP 

Each pixels have 8bit value

IMAGEPROC_IMGTYPE_16BPP 

Each pixels have 16bit value

Function Documentation

◆ imageproc_initialize()

void imageproc_initialize ( void  )

Initialize imageproc library

◆ imageproc_finalize()

void imageproc_finalize ( void  )

Finalize imageproc library

◆ imageproc_convert_yuv2rgb()

void imageproc_convert_yuv2rgb ( uint8_t *  ibuf,
uint32_t  hsize,
uint32_t  vsize 
)

Convert color format (YUV to RGB)

TODO: need more description here

Parameters
[in,out]ibufimage
[in]hsizeHorizontal size
[in]vsizeVertical size

◆ imageproc_convert_rgb2yuv()

void imageproc_convert_rgb2yuv ( uint8_t *  ibuf,
uint32_t  hsize,
uint32_t  vsize 
)

Convert color format (RGB to YUV)

Parameters
[in,out]ibufimage
[in]hsizeHorizontal size
[in]vsizeVertical size

◆ imageproc_convert_yuv2gray()

void imageproc_convert_yuv2gray ( uint8_t *  ibuf,
uint8_t *  obuf,
size_t  hsize,
size_t  vsize 
)

Convert color format (YUV to grayscale)

TODO: need more description here

Parameters
[in]ibufInput image
[out]obufOutput buffer
[in]hsizeHorizontal size
[in]vsizeVertical size

◆ imageproc_resize()

int imageproc_resize ( uint8_t *  ibuf,
uint16_t  ihsize,
uint16_t  ivsize,
uint8_t *  obuf,
uint16_t  ohsize,
uint16_t  ovsize,
int  bpp 
)

Resize image

Resize image specified by ibuf to ohsize, ovsize. Processed image will be stored to obuf.

For ohsize and ovsize, specify output size calculated by multiply in range 1/2^n to 2^n (n=0..5) against ihsize and ivsize.

This function can be processing for YUV422 color format. So all of specified sizes must be multiple of 2.

And there is limitation about output size below.

  • Shrink
    • Horizontal size least 12 pixels
    • Vertical size least 12 pixels
  • Enlarge
    • Horizontal size up to 768 pixels
    • Vertical size up to 1024 pixels
Parameters
[in]ibufInput image
[in]ihsizeInput horizontal size
[in]ivsizeInput vertical size
[out]obufOutput buffer
[in]ohsizeOutput horizontal size
[in]ovsizeOutput vertical size
[in]bppBits per pixel (16 or 8)
Returns
0 on success, otherwise error code.

◆ imageproc_clip_and_resize()

int imageproc_clip_and_resize ( uint8_t *  ibuf,
uint16_t  ihsize,
uint16_t  ivsize,
uint8_t *  obuf,
uint16_t  ohsize,
uint16_t  ovsize,
int  bpp,
imageproc_rect_t clip_rect 
)

Clip and Resize image

Parameters
[in]ibufInput image
[in]ihsizeInput horizontal size
[in]ivsizeInput vertical size
[out]obufOutput buffer
[in]ohsizeOutput horizontal size
[in]ovsizeOutput vertical size
[in]bppBits per pixel (16 or 8)
[in]clip_rectClipping rectangle on input image.
Returns
0 on success, otherwise error code.

◆ imageproc_alpha_blend()

int imageproc_alpha_blend ( imageproc_imginfo_t dst,
int  pos_x,
int  pos_y,
imageproc_imginfo_t src,
imageproc_imginfo_t alpha 
)

Execute alpha blending

Execute alpha blending. dst buffer is overwritten by blended image.

Parameters
[in,out]dstDestination image. dst->type = IMAGEPROC_IMGTYPE_16BPP.
[in]pos_xx-coordinate of blended position. Minus value means the left of the destination image origin.
[in]pos_yy-coordinate of blended position. Minus value means the upper of the destination image origin.
[in]srcSource image. src->type = IMAGEPROC_IMGTYPE_16BPP or IMAGEPROC_IMGTYPE_SINGLE.
[in]alphaAlpha plane. alpha->type = IMAGEPROC_IMGTYPE_SINGLE, IMAGEPROC_IMGTYPE_BINARY, or IMAGEPROC_IMGTYPE_8BPP.
Returns
0 on success, otherwise error code.