Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6729 Discussions

anchor cell for ippiConvFull and ippiConvValid

honana
Beginner
340 Views
Hi,

does anyone know where it's located for both input images?
it seems to be in the middle. But how is it defined for even width or length?
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
340 Views
Hi, there is answer from our expert

Suffixes Full and Valid should be interpreted in MatLab approach. These both cases are symmetrical in contradict to the MatLab Same that means that the result of convolution does not depend on the sources order. This is the cause why only Full and Valid are implemented. For the Same case (C1 only) a simple general ippiFilter can be used. As about an anchor point it can be understood from the function suffix and does not depend on the even or odd image size. For example Valid case convolution can be treated as a filter with the anchor in the right bottom point of the kernel (the smallest input source) and with the recalculated output size:

Code:
static IppStatus EmulateValid_32f_C1R( Ipp32f* pSrc1, int src1Step,
        IppiSize src1Size, Ipp32f* pSrc2, int src2Step, IppiSize src2Size,
        Ipp32f* pDst, int dstStep )
{
    IppStatus status = ippStsMemAllocErr;
    int k = 0;
    Ipp32f* buf = NULL;
    IppiSize dstSize;
    IppiPoint anchor;

    anchor.x = src2Size.width - 1;
    anchor.y = src2Size.height - 1;
    /* recalculated ROI */
    dstSize.width = src1Size.width - anchor.x;
    dstSize.height = src1Size.height - anchor.y;
    if( src2Step != (int)( src2Size.width * sizeof(Ipp32f)) ) {
    /* it means that for filter function kernel should be without gaps */
        buf = ippsMalloc_32f( src2Size.width * src2Size.height );
        k++;
        if( NULL == buf ) return status;
        ippiCopy_32f_C1R( pSrc2, src2Step, buf,
                       src2Size.width * sizeof(Ipp32f), src2Size );
    } else {
        buf = pSrc2;
    }
    /* the buf here is the kernel */
    status = ippiFilter_32f_C1R( pSrc1, src1Step, pDst, dstStep,
                                       dstSize, buf, src2Size, anchor );
    if( k ) ippsFree( buf );
    return status;
}

The same can be said about Full, but anchor should be in the upper left point.

Regards,
Vladimir

0 Kudos
Reply