- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I get different results if I use the in-place flavor of the ippiFilterMinBorder/ippiFilterMaxBorder functions (pSrc is equal to pDst) compared to the not-in-place variants.
I observe some "artifacts" especially near the border. Can someone confirm this?
I'm using IPP 2017 Update 2.
Many thanks and best regards,
Norbert
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Norbert,
What function flavor do you use? Could you please provide the machine parameters and the code example that reproduces the issue?
Best regards,
Valentin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Valentin,
I use the x64 single-threaded static libraries on Win 7. Processor is Core i5 -2400.
Below is a short example compiled with VS 2015. I create a white-black image and apply the max. filter, first not-in-place and then in-place. At the end I count the # of white pixels in both result images. The counters are different:
#include <stdio.h>
#include "ipp.h"
#define WIDTH 128
#define HEIGHT 128
int main()
{
IppStatus status = ippStsNoErr;
Ipp8u* pSrc = nullptr, *pDst = nullptr;
int srcStep = 0, dstStep = 0;
IppiSize fullRoiSize = {WIDTH, HEIGHT};
IppiSize halfRoiSize = {WIDTH, HEIGHT / 2};
Ipp8u *pBuffer = nullptr;
int iTmpBufSize = 0;
IppiBorderType borderType = ippBorderRepl; // replicate border
Ipp8u borderValue = 0;
IppiSize maskSize = {3, 3};
pSrc = ippiMalloc_8u_C1 (fullRoiSize.width, fullRoiSize.height, &srcStep);
pDst = ippiMalloc_8u_C1 (fullRoiSize.width, fullRoiSize.height, &dstStep);
// Set top half of image to white
ippiSet_8u_C1R (255, pSrc, srcStep, halfRoiSize);
// Set bottom half of image to black
ippiSet_8u_C1R (0, pSrc + halfRoiSize.height * srcStep, srcStep, halfRoiSize);
status = ippiFilterMaxBorderGetBufferSize (fullRoiSize, maskSize, ipp8u, 1, &iTmpBufSize);
pBuffer = ippsMalloc_8u (iTmpBufSize);
// Not-in-place
status = ippiFilterMaxBorder_8u_C1R (pSrc, srcStep, pDst, dstStep, fullRoiSize, maskSize, borderType, borderValue, pBuffer);
// In-place
status = ippiFilterMaxBorder_8u_C1R (pSrc, srcStep, pSrc, srcStep, fullRoiSize, maskSize, borderType, borderValue, pBuffer);
// Count white pixels
int cntNIP = 0; // # pixels of not-in-place flavor
int cntIP = 0; // # pixels of in-place flavor
ippiCountInRange_8u_C1R (pDst, dstStep, fullRoiSize, &cntNIP, 254, 255);
ippiCountInRange_8u_C1R (pSrc, srcStep, fullRoiSize, &cntIP, 254, 255);
ippsFree (pBuffer);
ippiFree (pSrc);
ippiFree (pDst);
printf ("# pixels not-in-place: %d\n", cntNIP);
printf ("# pixels in-place: %d\n", cntIP);
getchar ();
return status;
}
Output:
# pixels not-in-place: 8320
# pixels in-place: 8322
Best regards,
Norbert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On Linux x64 dynamically linked, version 9.0.3 , processor i7-X980 , I have exactly the same behaviour:
# pixels not-in-place: 8320 # pixels in-place: 8322
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the same behaviour if I replace ippiFilterMaxBorder_8u_C1R by ippiDilateBorder_8u_C1R in the above example with all values of the structuring element (mask) set to 1. The mask is passed to ippiMorphologyBorderInit before calling the dilate function.
Best regards,
Norbert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Norbert,
Thank you for the information! You used the function without the descriptor "I" for in-place operation. It is not guaranteed that a function without "I" descriptor works correctly for in-place operation, IPP function is intended to work in not-in-place mode by default. So I do not recommend using a function without "I" descriptor for in-place operations.
Best regards,
Valentin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Valentin,
thanks for your reply. But I cannot find the appropriate function "ippiFilterMaxBorder_8u_C1IR" in the header files.
Best regards,
Norbert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The in-place variant of the functions ippiFilterMaxBorder_8u_C1R is absent in IPP 2017 Update 2. You can submit an application via Intel(R) Premier Support to request this functionality.
Best regards,
Valentin
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page