Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
6818 Discussions

Getting Null Pointer Error (-8) with OpenCV + ippiFilterBoxBorder

afdl
Beginner
1,015 Views

Hello, I'm trying to run some initial test with Intel IPP / FilterBox operator (version 2018 3.1), starting from an image opened with OpenCV.

I readed how to use it from https://software.intel.com/en-us/ipp-dev-reference-filterboxborder, basically I do the following:

- Open the image with OpenCV, grayscale
- call ippiFilterBoxBorderGetBufferSize, no errors here
- call ippsMalloc_8u to allocate buffer
- call ippiFilterBoxBorder_8u_C1R, this one returns -8 error (Null Pointer)

I can't underrstand why I receive the -8 error, while there are no Null data around and sizes are ok. Is it something related to OpenCV? I used that method after reding this: https://stackoverflow.com/questions/13465914/using-opencv-mat-images-with-intel-ipp

Any ideas? Here is the code, thank you!

---

cv::Mat a = cv::imread("test.jpg", CV_LOAD_IMAGE_GRAYSCALE);
int a_type = a.type(); // CV_8U
int a_channels = CV_MAT_CN(a.type()); // 1
cv::Mat res_ipp = a.clone(); // prepare the results starting from a copy of a

IppiSize srcSize = { a.cols, a.rows };
IppiSize kernelSize = { 51, 51 };
Ipp8u* pBuffer = NULL;
int bufSize = 0;
IppStatus s = NULL;
std::string ss;

s = ippiFilterBoxBorderGetBufferSize(srcSize, kernelSize, IppDataType::ipp8u, a_channels, &bufSize);
ss = ippGetStatusString(s); // no error here
pBuffer = ippsMalloc_8u(bufSize);

bool ac = a.isContinuous(); // returns TRUE
bool rc = res_ipp.isContinuous(); // returns TRUE
Ipp8u* a_p = a.ptr<Ipp8u>(); // not NULL
int a_step = (int)a.step; // equals to width of a
Ipp8u* res_p = res_ipp.ptr<Ipp8u>(); // not NULL
int res_step = (int)res_ipp.step; // equals to width of res_ipp

s = ippiFilterBoxBorder_8u_C1R(a_p, a_step, res_p, res_step, srcSize, kernelSize, IppiBorderType::ippBorderConst, 0, pBuffer);
ss = ippGetStatusString(s); // !!!! Null Pointer Error (-8)
if (pBuffer) ippsFree(pBuffer);

 

---

 

0 Kudos
2 Replies
Andrey_B_Intel
Employee
1,015 Views

Hi.

ippiFilterBoxBorder_8u_C1R has next API
IPPAPI(IppStatus, ippiFilterBoxBorder_8u_C1R,(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep,IppiSize roiSize,
    IppiSize maskSize, IppiBorderType border,const Ipp8u* borderValue, Ipp8u* pBuffer))
 
where const Ipp8u* borderValue is pointer but not value.
 
Thanks for use of IPP library.
 
 
 
0 Kudos
Francesconi__Alessan
1,015 Views

That was easy! Thank you, solved.

0 Kudos
Reply