A problem with ippiCanny_16s8u_C1R

A problem with ippiCanny_16s8u_C1R

amir l.的头像

Hi guys,

I wrote a small peice of code which works well on Windows and fails on Linux. 

I am using IPP 7.1, Linux Ubuntu 12.04.

In the code I am trying to use the canny filter and receive an error ippStsBadArgErr. I double checked and my lower threshold is lower than the high threshold.

The source code is:

#include "ippi.h"
#include <stdio.h>

Ipp8u SRC[1280*720];
Ipp8u DST[1280*720];
short dyy[1920*1920],dxx[1920*1920];

int main()
{
Ipp8u *src= SRC;
Ipp8u *dst= DST;
Ipp8u *buffer;
Ipp16s *dx= dxx;
Ipp16s *dy= dyy;
float low_edge_thresh= 0.1;
float high_edge_thresh= 1;
int width= 1280;
int height= 720;
IppStatus sts;
int size, size1, srcStep, dxStep, dyStep, dstStep;
IppiSize roi= {width,height};
srcStep= dstStep= width;
dxStep= dyStep= 2*width;

// read source frame
FILE *f= fopen("Fame_1280x720.yuv", "rb");
fread(src, 1, 1280*720, f);
fclose(f);

sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size);
sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size1);
if (size<size1) size=size1;
ippiCannyGetSize(roi, &size1);
if (size<size1) size=size1;

buffer = malloc(size);

sts = ippiFilterSobelNegVertBorder_8u16s_C1R (src, srcStep, dx, dxStep, roi, ippMskSize3x3, ippBorderRepl, 0, buffer);
printf("sts=%d\n", sts);
sts = ippiFilterSobelHorizBorder_8u16s_C1R(src, srcStep, dy, dyStep, roi, ippMskSize3x3, ippBorderRepl, 0, buffer);
printf("sts=%d\n", sts);
sts = ippiCanny_16s8u_C1R(dx, dxStep, dy, dyStep, dst, dstStep, roi, low_edge_thresh, high_edge_thresh, buffer);
printf("sts=%d\n", sts);
}

Thank you

8 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Sergey Kostrov的头像

>>...
>>FILE *f= fopen("Fame_1280x720.yuv", "rb");
>>...

Could you upload "Fame_1280x720.yuv" file?

amir l.的头像

For our simple test we can omit these 3 lines since it doesn't really matter what the bitmap is:

#include "ippi.h"
#include "ipp.h"
#include
#include

Ipp8u SRC[1280*720];
Ipp8u DST[1280*720];
short dyy[1920*1920],dxx[1920*1920];

int main()
{
Ipp8u *src= SRC;
Ipp8u *dst= DST;
Ipp8u *buffer;
Ipp16s *dx= dxx;
Ipp16s *dy= dyy;
float low_edge_thresh= 0.1;
float high_edge_thresh= 1;
int width= 1280;
int height= 720;
IppStatus sts;
int size, size1, srcStep, dxStep, dyStep, dstStep;
IppiSize roi= {width,height};
srcStep= dstStep= width;
dxStep= dyStep= 2*width;

// read source frame
// FILE *f= fopen("Fame_1280x720_10f_org.yuv", "rb");
//fread(src, 1, 1280*720, f);
//fclose(f);

sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size);
sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size1);
if (size ippiCannyGetSize(roi, &size1);
if (size

buffer = (Ipp8u*)malloc(size);

sts = ippiFilterSobelNegVertBorder_8u16s_C1R (src, srcStep, dx, dxStep, roi, ippMskSize3x3, ippBorderRepl, 0, buffer);
printf("sts=%d\n", sts);
sts = ippiFilterSobelHorizBorder_8u16s_C1R(src, srcStep, dy, dyStep, roi, ippMskSize3x3, ippBorderRepl, 0, buffer);
printf("sts=%d\n", sts);
sts = ippiCanny_16s8u_C1R(dx, dxStep, dy, dyStep, dst, dstStep, roi, low_edge_thresh, high_edge_thresh, buffer);
printf("sts=%d\n", sts);
}

Sergey Khlystov (Intel)的头像

Hi,

Your sample shows no error on Canny (sts=0). Could you provide more detail on how you build the sample?

Regards,
Sergey

Regards, Sergey
amir l.的头像

This is the compilation command:
gcc -g test.c -o test -L/opt/intel/ipp/lib/intel64 -I/opt/intel/ipp/include -lippcore -lipps -lippi -lippvc -lippcv

I use Ubuntu 12.04.

amir l.的头像

I repeated the same experiment with RadHat and it works.

amir l.的头像

Thank u for your help.
I found the problem: In Linux "ipp.h" was not included and the compilation passed.
In Windows it failed. When I added ipp.h to the include files the error disappeared.

Sergey Kostrov的头像

Your statements are contradicting:

>>...I wrote a small peice of code which works well on Windows and fails on Linux...

and

>>...In Linux "ipp.h" was not included and the compilation passed. In Windows it failed...

Anyway, thanks for the update.

登陆并发表评论。