主要内容

QHVXIPCV.conv2d

2-D convolution for HVX

Since R2026a

Description

conv2DOut = QHVXIPCV.conv2d(Input,Mask) performs a 2-D convolution of the input matrix Input with the structuring element Mask for Hexagon® Vector eXtension.

example

Examples

collapse all

Create a unit8 matrix. Specify the width of the input matrix as a multiple of 128.

H = 128; 
W = 128;                 
A = uint8(rand(H, W));

Create the mask with kernel sizes 3, 5, and 7.

mask3x3 = int8([ 1  2  1;0  0  0;-1 -2 -1 ]);
mask5x5 = int8([1  2  3  2  1;...
                2  4  5  4  2;...
                3  5  6  5  3;...
                2  4  5  4  2;...
                1  2  3  2  1]);
mask7x7 = int8([0  0  1  2  1  0  0;...
                0  1  2  3  2  1  0;...
                1  2  3  4  3  2  1;...
                2  3  4  5  4  3  2;...
                1  2  3  4  3  2  1;...
                0  1  2  3  2  1  0;...
                0  0  0  1  2  1  0]);

Perform convolution of the input matrix and the masks.

out3 = QHVXIPCV.conv2d(A, mask3x3);
out5 = QHVXIPCV.conv2d(A, mask5x5);
out7 = QHVXIPCV.conv2d(A, mask7x7);

Input Arguments

collapse all

2-D input, specified as a matrix whose width is a multiple of 128. The height of the matrix must be greater than or equal to the mask size.

Data Types: uint8

Structuring element, specified as a 2-D square matrix of size 3, 5, or 7.

Data Types: int8

Output Arguments

collapse all

Convolution output of the input matrix and the mask, returned as a matrix.

Data Types: uint8

Version History

Introduced in R2026a

See Also