- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did not find an example online, so I figure out by myself how to use it from header file, but the SIGSEGV recalls me that I need to better understand. So here is the example and the output , I use compilers_and_libraries_2017.1.132 #include <iostream> #include <dlfcn.h> #include <ippbase.h> #include <ipptypes.h> #include <ipp.h> using std::cout; using std::endl; void erodeAlongXAxis(Ipp8u *input,int w, int h, int kernelWidth) { IppiSizeL roiSizeL; roiSizeL.width = w; roiSizeL.height = h; IppiSize roiSize; roiSize.width = w; roiSize.height = h; int w8 = w / 8; cout << "w8 " << w8 << endl; Ipp8u *bitMask = ippsMalloc_8u(w8 * h); IppStatus status = ippiGrayToBin_8u1u_C1R(input, w, bitMask, w8, 0, roiSize, 1); cout << "ippiGrayToBin_8u1u_C1R status " << status << endl; Ipp8u *sliceBitMask = ippsMalloc_8u(w8 * h); Ipp8u borderValue[1]; borderValue[0] = (Ipp8u) 0; IppiSizeL maskSize; maskSize.width = kernelWidth; maskSize.height = 1; IppSizeL specSize; status = ippiErodeGetSpecSize_L(roiSizeL, maskSize, &specSize); cout << "ippiErodeGetSpecSize_L status " << status << endl; IppiMorphStateL *pMorphSpec = (IppiMorphStateL *) (ippsMalloc_8u(specSize)); IppSizeL bufferSize; ippiErodeGetBufferSize_L(roiSizeL, maskSize, ipp1u, 1, &bufferSize); Ipp8u *pBuffer = ippsMalloc_8u(bufferSize); Ipp8u *pMask = ippsMalloc_8u(maskSize.width * maskSize.height); for (int i = 0; i < maskSize.width * maskSize.height; i++) { pMask = 1; } status = ippiErodeInit_L(roiSizeL, pMask, maskSize, pMorphSpec); cout << "ippiErodeInit_L status " << status << endl; status = ippiErode_1u_C1R_L(bitMask , w8, 0, sliceBitMask, w8, 0, roiSizeL, ippBorderConst, borderValue, pMorphSpec, pBuffer); cout << "ippiErode_1u_C1R_L status " << status << endl; } int main(int argc, char *argv[]) { const int w = 16; const int h = 5; Ipp8u *input = ippsMalloc_8u(w*h); for(int i = 0; i < w*h; i++) { // create diagonal stripe input = ((i/w)+(i%w)) % (h+4) < h ? 1 : 0; } for(int y = 0 ; y < h; y++) { for(int x = 0; x < w ; x++) { cout << "\t" << (0+input[x+y*w]); } cout << endl; } erodeAlongXAxis(input, w, h, 3); }
/home/bgy/work2017/Test/cmake-build-debug/TestErode
1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0
1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0
1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0
1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1
1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1
w8 2
ippiGrayToBin_8u1u_C1R status 0
ippiErodeGetSpecSize_L status 0
ippiErodeInit_L status 0
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Benoit,
I tested your code and it went through with no error.
i just commented out #include <dlfcn.h> .
Would you mind trying upgrade your IPP to IPP 2018 U1 and try once more?
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have try again with new ipp2018 U1, and there is no more problem.
/home/bgy/work2017/itk-boxes/Thresh_Clean_Peak/cmake-build-debug/TestErode
1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0
1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0
1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0
1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1
1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1
w8 2
ippiGrayToBin_8u1u_C1R status 0
ippiErodeGetSpecSize_L status 0
ippiErodeInit_L status 0
ippiErode_1u_C1R_L status 0
Process finished with exit code 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your confirmation. Feel free to contact us if you have questions.
regards,
Chao
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page