A question about Borders.

A question about Borders.

Hi all,

I have a question about the borders. In the morphology operations, why "DilateBorderReplicate" and "ErodeBorderReplicate" need to consider the border effect? But "Dilate" and "Erode" do not?

I think in bother situations, we should all include the border effects.


5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello, both of function variants doneed border pixels to process. In general, functions contained in ippIP domainare more general and functions which are contained in area specific domains, like ippCV - Computer Vision specific functions, are more area oriented.



The reason is mainly historical. First IPP image processing functions practice the usage model that assume existing border pixels in memory. The real image size in memory for such functions is (height+2*bordersize)*(width+2*bordersize). In such conditions it is possible to calculate border pixels, to place them to memory and do not take in mind border condition while image processing. But the user should to transform (add borders) the initial image of size height*width.

Later, especially after introduction of Computer Vision IPP domain many customers asked for functions that work with images of their natural size. For example OpenCV library works with such images. For these reasons some functions handling images without border pixels in memory were introduced to ippCV doimain library. Generally, such functions have "Border" suffix in their name.


Really appeciate your answers!

But something I am still confused, those boundary effects bother me a lot. I am sorry I have to keep on asking.

1. You explained those functions which include "border" do not need to place the border pixels in the memory. But why the ErodeBorderReplicate and ErodeBorderReplicate functions still specify the borderType as ippBorderRepl? How did IPP deal with the boundary pixels in these 2 functions? Overlook the pixels out of the boundary?

2. In functions, such as Dilate and Erode, based on your explaination, they should place the border pixels in memory (which destination image might be larger than source image). What kind of method IPP choose (wrap, repl or const)? Did IPP call CopyReplicateBorder or CopyWrapBorder?

Thanks a lot

If you have border pixels in memory you need not to describe the border type - all border pixels are simply read from memory.If you have no border pixels in memory (as in functions with "Border" suffix) you need define in some way what border pixels are. It is the sense of "border" argument. Eg if border=ippBorderConst functions process pixels close to the image border as if constant pixels are ajacent to the image from the outer side. Other border types are processed similarly.If you are going to use functions ippiErode/Dilate without "Border" suffix you need to allocate memory for the image with the border. Then the image can be extended by CopyReplicatBorder or CopyWrapBorder functions or manually if you use the other type of the border. If you do not provide the memory for border pixels you'll get read or write to wrong memory address.Alexander

Leave a Comment

Please sign in to add a comment. Not a member? Join today