![]() |
IPSDK
4_1_0_2
IPSDK : Image Processing Software Development Kit
|
Image border policy and usage. More...
Functions | |
| IPSDKIMAGE_API Border2dPolicyPtr | ipsdk::image::valuedBorder2d (const ipReal64 fillValue) |
| function allowing to generate a 2d border manager used to extend border values to a constant given value | |
| IPSDKIMAGE_API Border2dPolicyPtr | ipsdk::image::valuedMaxBorder2d () |
| function allowing to generate a 2d border manager used to extend border values using a maximum value for a given image type | |
| IPSDKIMAGE_API Border2dPolicyPtr | ipsdk::image::valuedMinBorder2d () |
| function allowing to generate a 2d border manager used to extend border values using a minimum value for a given image type | |
| IPSDKIMAGE_API Border2dPolicyPtr | ipsdk::image::continueBorder2d () |
| function allowing to generate a 2d border manager used to extend border values by direct continuity | |
| IPSDKIMAGE_API Border2dPolicyPtr | ipsdk::image::mirorBorder2d () |
| function allowing to generate a 2d border manager used to extend border values mirroring existing data | |
| IPSDKIMAGE_API Border3dPolicyPtr | ipsdk::image::valuedBorder3d (const ipReal64 fillValue) |
| function allowing to generate a 3d border manager used to extend border values to a constant given value | |
| IPSDKIMAGE_API Border3dPolicyPtr | ipsdk::image::valuedMaxBorder3d () |
| function allowing to generate a 3d border manager used to extend border values using a maximum value for a given image type | |
| IPSDKIMAGE_API Border3dPolicyPtr | ipsdk::image::valuedMinBorder3d () |
| function allowing to generate a 3d border manager used to extend border values using a minimum value for a given image type | |
| IPSDKIMAGE_API Border3dPolicyPtr | ipsdk::image::continueBorder3d () |
| function allowing to generate a 3d border manager used to extend border values by direct continuity | |
| IPSDKIMAGE_API Border3dPolicyPtr | ipsdk::image::mirorBorder3d () |
| function allowing to generate a 3d border manager used to extend border values mirroring existing data | |
Image border policy and usage.
This page introduces the image border policies used by kernel-based algorithms.
Some image processing algorithms, such as convolution or mean smoothing algorithms, compute the result for each pixel according to a local neighbourhood
. Since the whole neighbourhood is known, such calculation is not an issue for pixels with coordinates
and
, where
and
are respectively the half size of
and the image size along the direction
and
is the pixel coordinate along this direction. However, for pixels on the borders of the image, some information is missing (see the figure below).
In order to process these pixels, the algorithm has to determine the values of the pixels out of the image. For this, one of the following hypothesis is necessary:
The first type of border policy is ipsdk::image::valuedBorder2d.
It defines a border policy with a specific value. It can be used to set a neutral value to the pixels out of the image. For example, this value can be set to 0 when computing a sum along the pixel's local neighbourhood.
The following figure illustrates the case that the pixels out of the image have been initialize with zero values (only the pixels inside the kernel are represented). This way, calculating the sum along the kernel will only take into account the values inside the image: 64+192+128+128+64+32+32+128+64 = 832.
The following Python sample loads an image and computes a convolution with a valued border policy initializing the pixels out of the image with 0 values:
The C++ code equivalent to the previous python script is:
The following figure illustrates two examples of value border policy on the image of Lena. The first one initializes the pixels out of the image to 0 whereas the second initializes them to 128.
The second type of border policy is ipsdk::image::continueBorder2d.
With this border policy, the pixels out of the image will have the same value than the pixel along the border of the image, as shown in the following figure:
The followong command shows how to build a continue border policy in python. This instruction replaces the line 19 in the first sample:
The equivalent C++ code is:
The following figure illustrates the continue border policy on the image of Lena.
The third type of border policy is ipsdk::image::mirorBorder2d.
With this border policy, the pixels out of the image will simulate a mirror effect of the image. Two kinds of mirror effect exist:
is the first pixel inside the image), we can express the copy by
. In this case, we will obtain
,
, etc. This is the mirror policy used by IPSDK.
is the first pixel inside the image), we can express the copy by
. In this case, we will obtain
,
, etc.
The followong example shows how to build a mirror border policy in python. This instruction replaces the line 19 in the first sample:
The equivalent C++ code is:
The following figure illustrates the mirror border policy on the image of Lena.
1.8.14