Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.

C# and ippiIntegral_8u32s_C1R

teres
Beginner
223 Views

Hi

I'm trying to use IPP with C# and I don't know how to do it right way. I'm trying to calculate integral image.

Below is my code.

[DllImport("ippcvv8-5.3.dll")]

public static extern IppStatus ippiIntegral_8u32s_C1R(byte* tab, int step, byte* tab2, int dstep,IppiSize roiSize, int val);

pSrc = new byte[20] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };

pDst = new byte[30];

int step = 5;

roi = new IppiSize(5, 4);

fixed(byte* pSrc2=pSrc, pDst2 = pDst)
{

IppStatus st = ippiIntegral_8u32s_C1R(pSrc2, 5, pDst2, 24, roi, 1);
}

IppStatus shows no errors, but pDst looks like this:

(1, 0, 0, 0, 1, 0,

0, 0, 1, 0, 0, 0,

1, 0, 0, 0, 1, 0,

0, 0, 1, 0, 0, 0,

1, 0, 0, 0, 2, 0)

Can you tell, what am I doing wrong ?

0 Kudos
1 Solution
Albert_Stepanov
New Contributor I
223 Views
Hi,
in the function ippiIntegral_8u32s the destination image is an integer type data. So, with code:
[DllImport("ippcv-5.3.dll")]
public static extern IppStatus ippiIntegral_8u32s_C1R(byte* pSrc, int srcStep, int* pDst, int dstStep, IppiSize roiSize, int val);
byte[] src = new byte[5*4] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
int[] dst = new int[6*5];
IppiSize roi = new IppiSize(5,4);
fixed( byte* pSrc=src ) fixed( int* pDst=dst )
{
IppStatus st = ippiIntegral_8u32s_C1R(pSrc, 5, pDst, 6*4, roi, 1);
}
you recieve the dst data as in the manual's example:
( 1, 1, 1, 1, 1, 1,
1, 2, 3, 4,5, 6,
1, 3, 5, 7,9, 11,
1, 4, 7, 10, 13, 16,
1, 5, 9, 13, 17, 21)

Regards,

Albert

View solution in original post

2 Replies
Albert_Stepanov
New Contributor I
224 Views
Hi,
in the function ippiIntegral_8u32s the destination image is an integer type data. So, with code:
[DllImport("ippcv-5.3.dll")]
public static extern IppStatus ippiIntegral_8u32s_C1R(byte* pSrc, int srcStep, int* pDst, int dstStep, IppiSize roiSize, int val);
byte[] src = new byte[5*4] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
int[] dst = new int[6*5];
IppiSize roi = new IppiSize(5,4);
fixed( byte* pSrc=src ) fixed( int* pDst=dst )
{
IppStatus st = ippiIntegral_8u32s_C1R(pSrc, 5, pDst, 6*4, roi, 1);
}
you recieve the dst data as in the manual's example:
( 1, 1, 1, 1, 1, 1,
1, 2, 3, 4,5, 6,
1, 3, 5, 7,9, 11,
1, 4, 7, 10, 13, 16,
1, 5, 9, 13, 17, 21)

Regards,

Albert

teres
Beginner
223 Views
Quoting - lee_step
Hi,
in the function ippiIntegral_8u32s the destination image is an integer type data. So, with code:

(...)

Regards,

Albert

Thank You very much.

Regards,

Tomek

Reply