decl_opr( 'WarpPerspective', inputs=[ Doc('src', 'input image, in (batch, channel, row, col), (batch,' 'row, col, channel) or (batch, channel / 4, row, col, 4) format, ' 'decided by Format(NHWC, NCHW, NCHW4).'), Doc('mat', 'batch-wise transforming matrix, in (batch, 3, 3) format. ' 'Note that this matrix maps from output coordinate to input ' 'coordinate'), Doc('out_shape', 'output image shape, containing two elements ' 'specifying output height and width')], params='WarpPerspective', desc='Apply perspective transformation to batched 2D images; ' 'see http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html ' 'for details on perspective transformations.') decl_opr( 'WarpPerspective', pyname='warp_perspective_mat_idx', inputs=[ 'src', 'mat', 'mat_idx', 'out_shape' ], params='WarpPerspective', desc='like :func:`warp_perspective`, but the **mat** param does not have ' 'to have the same batch size as **src**; instead, **mat_idx** specifies ' 'the batch number of each matrix in **mat**' ) decl_opr('Rotate', inputs=[ Doc('src', 'source image, in (batch, row, col, channel) format. ' 'Note the channel size must be 1 or 3')], params='Rotate', desc='Rotate images 90 degree, clockwise indicate the direction.') decl_opr('CvtColor', inputs=[ Doc('src', 'source image, in (batch, row, col, channel) format. ' 'Note the channel size must be 1 or 3 or 4')], params='CvtColor', desc='Converts images from one color space to another. ' 'see http://docs.opencv.org/2.4/modules/imgproc/doc/miscellaneous_transformations.html?highlight=cvtcolor#cv2.cvtColor' ' for details.') decl_opr('GaussianBlur', inputs=[ Doc('src', 'source image, in (batch, row, col, channel) format. ' 'Note the channel size must be 1 or 3')], params='GaussianBlur', desc='Blurs images using a Gaussian filter. ' 'http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html?highlight=gaussianblur#gaussianblur' ' for details.') decl_opr('Resize', inputs=[ Doc('src', 'source image, in (batch, row, col, channel), ' '(batch, channel, row, col), (batch, channel / 4, row, col, 4) ' 'format, decided by specific format NHWC, NCHW or NCHW4'), Doc('out_shape', 'output image shape, containing two elements ' 'specifying output height and width')], params='Resize', desc='Resize an image. ' 'see http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html?highlight=resize#cv2.resize' ' for details.', version=1) decl_opr( 'WarpAffine', inputs=[ Doc('src', 'input image, in (batch, row, col, channel) format'), Doc('mat', 'batch-wise transforming matrix, in (batch, 2, 3) format. ' 'Note that this matrix maps from output coordinate to input ' 'coordinate'), Doc('out_shape', 'output image shape, containing two elements ' 'specifying output height and width')], params='WarpAffine', desc='Apply affine transformation to batched 2D images; ' 'see http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html ' 'for details on affine transformations.', version=1) decl_opr( 'Remap', inputs=[ Doc('src', 'input image, in NCHW format or NHWC format'), Doc('map_xy', 'map matrix with NHWC format. C must euqal to 2. ' 'dst(x, y) = src(mapX(x, y), mapY(x, y)' 'col in channel 0, and row in channel 1')], params='Remap', desc='Remap transformation to batched 2D images; ' 'see https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html?highlight=remap' 'for details on remap transformations.') decl_raw_opr( 'dct_channel_select', inputs=[ Doc('src', 'input image, uint8 data type with NCHW format'), Doc('mask_offset', 'out channel offset array'), Doc('mask_val', 'out index per channel'), ], params='DctChannelSelect', body=[ 'if mask_offset is None:', ' all_inputs = _helper.canonize_input_vars([src], comp_graph=comp_graph, config=config)', 'else:', ' all_inputs = _helper.canonize_input_vars([src, mask_offset, mask_val], comp_graph=comp_graph, config=config)', 'cvt_result_kwargs = {}', 'param = _helper.cvt_to_opr_param_def(param, _opr_param_defs.DctChannelSelect, kwargs)', 'assert not kwargs, "extra kwargs: {}".format(kwargs)', 'all_params = []', 'all_params.append(param.serialize())', 'output = _mgb._create_opr("DctChannelSelect", all_inputs, all_params, config)', ], has_out_dtype=True, desc='DctChannelSelect do DCT with channel select' 'see https://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html?highlight=dct#dct' 'for details on DCT transformations. It will output float32 or qint8') # vim: ft=python