ConvValid

Performs a valid convolution of two images.

Syntax

Case 1: Operation on integer data

IppStatus ippiConvValid_<mod>(const Ipp<datatype>* pSrc1, int src1Step, IppiSize src1Size, const Ipp<datatype>* pSrc2, int src2Step, IppiSize src2Size, Ipp<datatype>* pDst, int dstStep, int divisor);

Supported values for mod:

8u_C1R 16s_C1R
8u_C3R 16s_C3R
8u_AC4R 16s_AC4R

Case 2: Operation on floating-point data

IppStatus ippiConvValid_<mod>(const Ipp32f* pSrc1, int src1Step, IppiSize src1Size, const Ipp32f* pSrc2, int src2Step, IppiSize src2Size, Ipp32f* pDst, int dstStep);

Supported values for mod:

32f_C1R
32f_C3R
32f_AC4R

Parameters

pSrc1, pSrc2

Pointers to the source images ROI.

src1Step, src2Step

Distances in bytes between starts of consecutive lines in the source images.

src1Size, src2Size

Sizes in pixels of the source images.

pDst

Pointer to the destination buffer ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

divisor

The integer value by which the computed result is divided (for operations on integer data only).

Description

The function ippiConvValid is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP). This function performs valid two-dimensional finite linear convolution operation between two source images pointed to by pSrc1 and pSrc2.

If we denote the first source image as a matrix f of size Mf by Nf and the second source image as a matrix g of size Mg by Ng, then the destination image h obtained as a result of the function operation will have size Mh by Nh, where Mh = | Mf - Mg| + 1 and Nh = |Nf - Ng| + 1.

The function ippiConvFull implements the following equation to compute values h[i,j] of the destination image:



where 0 i < Mh, 0 j < Nh.

Assume here that Mf Mg and Nf Ng. In case when Mf < Mg and Nf < Ng, the subscript index g in this equation must be replaced with the index f. For any other combination of source image sizes, the function ippiConvValid performs no operation.

Note that the above formula gives the same result as in the case of ippiConvFull function, but produces only that part of the convolution image which is computed without using zero-padded values.

Function flavors that accept input data of the Ipp32f type use the same summation formula, but no scaling of the result is done (divisor = 1 is assumed).

Example “Using the Convolution Functions” shows how to use the function ippiConvValid_16s_C1R.

To illustrate the function operation, for the source images f, g of size 3 x 5 represented as



with g = f,

the resulting convolution image h is of size 1 x 1 and contains the following data:

h = [11].

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error.

ippStsNullPtrErr

Indicates an error condition if pSrc1, pSrc2, or pDst is NULL.

ippStsSizeErr

Indicates an error condition if src1Size or src2Size has a zero or negative value.

ippStsStepErr

Indicates an error condition if src1Step, src2Step, or dstStep has a zero or negative value.

ippStsDivisorErr

Indicates an error condition if divisor has a zero value.

ippStsMemAllocErr

Indicates an error condition if memory allocation failed.

Using the Convolution Functions

Ipp8u src1[8*4]={ 0, 1, 2, 3, 4, 5, 6, 7,
                  0, 1, 2, 3, 4, 5, 6, 7,
                  7, 6, 5, 4, 3, 2, 1, 0,
                  7, 6, 5, 4, 3, 2, 1, 0}; 
Ipp16s src2[3*3];
Ipp16s dst1[6*6];
Ipp16s dst2[2*2];
IppiSize src1Size = { 4, 4 };
IppiSize src2Size = { 3, 3 };
int divisor = 2;
int sign = 1;

ippiGenSobelKernel_16s ( src2, 9, 8, sign);    // using "Sobel" kernel
    
ippiConvFull_16s_C1R ( src1, 8*sizeof(Ipp16s), src1Size, src2,
                  3*sizeof(Ipp16s), src2Size, dst1, 6*sizeof(Ipp16s), 2 );
ippiConvValid_16s_C1R ( src1, 8*sizeof(Ipp16s),  src1Size,  src2,
                  3*sizeof(Ipp16s), src2Size, dst2, 2*sizeof(Ipp16s), 2 );

Result:

0 1 2 3
0 1 2 3
7 6 5 4    src1
7 6 5 4

  1  -8   28
-56  70  -56    src2
 28  -8    1


   0    0   -3    8   16   42
   0  -28  -24  -34   65  -42
   4  -39   80   58   92  -26
-192   66  -26   -4   43  -54        Output of ippiConvFull  (dst1)
 -98  133  -76  -66  -14 -110
  98   56   50   39  -14    2

         80  59    Output of ippiConvValid (dst2)
        -26  -5



Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.