vpc_pyrdown

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

x

Atlas A2 training products/Atlas A2 inference products

x

Atlas training products

x

Atlas inference products

Atlas 200I/500 A2 inference products

x

Function Usage

Downsamples an image using a pyramid. Only YUV400 format images are supported. This API is asynchronous.

Prototype

  • C Prototype
    1
    hi_s32 hi_mpi_vpc_pyrdown(hi_vpc_chn chn,  const hi_vpc_pic_info *source_pic, hi_vpc_pic_info dest_pic[], hi_u32 filter_level, hi_s8 gaussian_filter[][5], hi_u16 divisor, hi_vpc_make_border_info make_border_info, hi_u32 *task_id, hi_s32 milli_sec);
    
  • Python Function
    1
    task_id, ret = acl.himpi.vpc_pyrdown(chn, source_pic, dest_pic, filter_level, gaussian_filter, divisor, make_border_info, milli_sec)
    

Parameter Description

Parameter

Description

chn

Int, channel ID for image processing.

Atlas inference products: The value range of this parameter is [0, 256). The maximum number of channels is 256.

source_pic

Dict, input image information. For details, see hi_vpc_pic_info. Only YUV400 format images are supported. The allowed maximum resolution is 2048 x 2048. The allowed minimum resolution varies with filter_level as follows:
  • If filter_level = 1, the allowed minimum resolution is 20 x 12.
  • If filter_level = 2, the allowed minimum resolution is 40 x 24.
  • If filter_level = 3, the allowed minimum resolution is 80 x 48.
  • If filter_level = 4, the allowed minimum resolution is 160 x 96.

dest_pic

Dict, target image information. For details, see hi_vpc_pic_info. The length of this array is the same as that of the filter_level parameter.
  • dest_pic[0] stores the image whose width and height are reduced to 1/2 of the source image.
  • dest_pic[1] stores the image whose width and height are reduced to 1/4 of the source image.
  • dest_pic[2] stores the image whose width and height are reduced to 1/8 of the source image.
  • dest_pic[3] stores the image whose width and height are reduced to 1/16 of the source image.

filter_level

Int, number of layers in the pyramid. Must be in the range of [1, 4].

gaussian_filter

List, Gaussian filtering parameter. A 5 x 5 list needs to be passed. You can pass None to use the default value. For details, see the following.
gaussian_filter = [
    [1, 4,  6,  4,  1],
    [4, 16, 24, 16, 4],
    [6, 24, 36, 24, 6],
    [4, 16, 24, 16, 4],
    [1, 4,  6,  4,  1]
]

divisor

Int, a divisor of the filter. Must be a power of 2.

make_border_info

Dict, information about border making. For details, see hi_vpc_make_border_info. A border with a length of 2 pixels is created. The supported border types are HI_BORDER_CONSTANT, HI_BOARD_REPLICATE, and HI_BOARD_REFLECT.

milli_sec

Int, timeout interval, in milliseconds.
  • -1: blocking mode.
  • 0: non-blocking mode.
  • > 0: timeout interval (timeout mode). The timeout interval varies with the operating system. The deviation is generally within a time slice of an operating system. For example, if the time slice of an operating system is 4 ms and the value of milli_sec is set to 1, the actual timeout interval ranges from 1 ms to 5 ms. When the CPU load is high, the timeout interval may fluctuate.

Return Value Description

Return Value

Description

ret

Int, error code.

task_id

Int, task ID, used to identify a task.