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

A problem with ippiCanny_16s8u_C1R

amir_l_
Beginner
688 Views

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

0 Kudos
7 Replies
SergeyKostrov
Valued Contributor II
688 Views
>>... >>FILE *f= fopen("Fame_1280x720.yuv", "rb"); >>... Could you upload "Fame_1280x720.yuv" file?
0 Kudos
amir_l_
Beginner
688 Views
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
0 Kudos
Sergey_K_Intel
Employee
688 Views
Hi, Your sample shows no error on Canny (sts=0). Could you provide more detail on how you build the sample? Regards, Sergey
0 Kudos
amir_l_
Beginner
688 Views
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.
0 Kudos
amir_l_
Beginner
688 Views
I repeated the same experiment with RadHat and it works.
0 Kudos
amir_l_
Beginner
687 Views
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.
0 Kudos
SergeyKostrov
Valued Contributor II
688 Views
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.
0 Kudos
Reply