示例#1
0
static vx_convolution vxCreateGaussian5x5Convolution(vx_context context)
{
    vx_convolution conv = vxCreateConvolution(context, 5, 5);
    vx_status status = vxWriteConvolutionCoefficients(conv, (vx_int16 *)gaussian5x5);
    if (status != VX_SUCCESS)
    {
        vxReleaseConvolution(&conv);
        return NULL;
    }

    status = vxSetConvolutionAttribute(conv, VX_CONVOLUTION_ATTRIBUTE_SCALE, (void *)&gaussian5x5scale, sizeof(vx_uint32));
    if (status != VX_SUCCESS)
    {
        vxReleaseConvolution(&conv);
        return NULL;
    }
    return conv;
}
示例#2
0
vx_status example_conv(vx_context context)
{
    //! [assign]
    // A horizontal Scharr gradient operator with different scale.
    vx_int16 gx[3][3] = {
        {  3, 0, -3},
        { 10, 0,-10},
        {  3, 0, -3},
    };
    vx_uint32 scale = 9;
    vx_convolution scharr_x = vxCreateConvolution(context, 3, 3);
    vxAccessConvolutionCoefficients(scharr_x, NULL);
    vxCommitConvolutionCoefficients(scharr_x, (vx_int16*)gx);
    vxSetConvolutionAttribute(scharr_x, VX_CONVOLUTION_ATTRIBUTE_SCALE, &scale, sizeof(scale));
    //! [assign]
    vxReleaseConvolution(&scharr_x);
    return VX_SUCCESS;
}