IPP image processing common function description

column directory

1. Introduction to IPP and installation instructions under Windows
2. Use of IPP with Opencv
3. Naming format of IPP image processing functions
4. Description of commonly used functions in IPP image processing

illustrate

1. Version
IPP2021
2. Official website
image processing developer manual

1. Threshold processing

1. Function prototype

Take local operation of a single channel as an example

IppStatus ippiThreshold_<mod>(Ipp<datatype>* pSrcDst, 
								int srcDstStep, 
								IppiSize roiSize, 
								Ipp<datatype> threshold, 
								IppCmpOp ippCmpOp);

2. Calculation formula

insert image description here
insert image description here
It can be seen from the formula that if the pixel value satisfies the condition, it is set as the threshold, otherwise it remains unchanged.

3. Threshold_Val function

(1) Function prototype

IppStatus ippiThreshold_Val_<mod>(
								Ipp<datatype>* pSrcDst, 
								int srcDstStep, 
								IppiSize roiSize, 
								Ipp<datatype> threshold, 
								Ipp<datatype> value, 
								IppCmpOp ippCmpOp);

(2) Description

The difference between Threshold_Val and Threshold is that the pixels that meet the condition will be set to a fixed value.

4. The meaning of related parameters

(1) Source image pointer and step size

pSrc,srcStep;

(2)roiSize

The original image and the target image ROI area, the function only processes the pixels of the ROI area

(3)ippCmpOp

The operation specified for comparing pixel values ​​to a threshold. You can use "less than" or "greater than" comparisons.

ippCmpOp=ippCmpGreater;
ippCmpOp=ippCmpLess;

5. Official Website Development Manual

url

2. Filter function

Take the median filter (FilterMedianBorder) as an example

1. Function prototype

IppStatus ippiFilterMedianBorder_<mod>(const Ipp<datatype>* pSrc, 
										int srcStep, 
										Ipp<datatype>* pDst, 
										int dstStep, 
										IppiSize dstRoiSize, 
										IppiSize maskSize, 
										IppiBorderType borderType, 
										Ipp<datatype> borderValue, 
										Ipp8u* pBuffer);
mod=8u_C1R
mod=16u_C1R	
mod=16s_C1R	
mod=32f_C1R

2. Function description

The function operates on the ROI.
Before using this function, you need to use the ippiFilterMedianBorderGetBufferSize function to calculate the size of the working buffer pBuffer.
The ippiFilterMedianBorder function applies a median filter to an image ROI. The anchor unit is the center of the filter kernel. The size of the source image ROI is equal to the size dstRoiSize of the destination image ROI.
The function sets each pixel in the destination buffer to the median of all source pixel values ​​near the pixel being processed.

3. ippiFilterMedianBorderGetBufferSize function

(1) Function description

Calculate the size of the working buffer (buffer) of the FilterMedianBorder function.
The ippiFilterMedianBorderGetBufferSize function calculates the size (in bytes) of the external working buffer required by the ippiFilterMedianBorder function. The result is stored in the parameter pBufferSize.

(2) Related parameters

A total of five parameters, the first four are input parameters, the last one is the output parameter
[1] dstRoiSize
target ROI size
[2] maskSize
filter kernel size
[3] dataType
source image and target image type
[4] numChannels
image channel Number, 1, 3, 4 channels
[5] pBufferSize
is a pointer to the calculated size of the external working buffer, and the unit is byte.

4. Related parameters

(1) The seventh parameter

Border type
[1] ippBorderConst
sets border pixel values ​​to constants
[2] ippBorderRepl
copies border pixel values
​​[3] ippBorderInMem
border values ​​are obtained from pixel values ​​in the original image

(2) The eighth parameter

The border value borderValue
is the constant value assigned to the pixels of the constant border. This parameter only applies to the ippBorderConst border type.
pBorderValue[3],
pBorderValue[4]
pointers to constants for pixels assigned to constant borders. This parameter only applies to the ippBorderConst border type.

(3) The ninth parameter

pBuffer: pointer to working buffer

5. Official Website Development Manual

url

3. Arithmetic operations

Take subtraction (Sub) as an example.

1. Function prototype

IppStatus ippiSub_<mod>(const Ipp<datatype>* pSrc1, 
						int src1Step, 
						const Ipp<datatype>* pSrc2, 
						int src2Step, 
						Ipp<datatype>* pDst, 
						int dstStep, 
						IppiSize roiSize, 
						int scaleFactor);

type of mod

8u_C1RSfs
16u_C1RSfs
16s_C1RSfs
8u_C3RSfs
16u_C3RSfs
16s_C3RSfs
8u_AC4RSfs
16u_AC4RSfs
16s_AC4RSfs
8u_C4RSfs
16u_C4RSfs
16s_C4RSfs

2. Function description

This function subtracts the pixel value in source buffer pSrc1 from the corresponding pixel value in buffer pSrc2 and places the result in destination buffer pDst. For an in-place operation, the value in pSrc is subtracted from the value in pSrcDst, and the result is placed in pSrcDst. For complex data, this function works on both the real and imaginary parts of the pixel values.

3. Related parameters

(1) Original image

In-place operation has one parameter, non-in-place operation has two parameters
pSrc, in-place operation, one original image
pSrc1, pSrc2, non-in-place operation, two original images

(2) Step size

The step size corresponding to the number of original images, the step size is immediately behind the image pointer

(3)pDst、dstStep

Destination image pointer and step size, for non-in-place operations

(4)pSrcDst、srcDstStep

target image pointer and step size, for in-place operations

(5)roiSize

ROI size

(6)scaleFactor

Scale factor
Scaling of integer results
The default for image processing functions is to saturate the result without scaling it.
Some image processing functions that operate on integer data scale the output of internal computations using the integer scaleFactor , which is specified as one of the function arguments. These functions have Sfs descriptors in their names.
The scale factor can be negative, positive, or zero. Scaling is applied because internal calculations are usually performed with a higher precision than the data type of the input and output images.
Even with scaling, the results of integer operations always saturate the range of the target data type.
Scaling of integer results is done by multiplying the output pixel values ​​by 2^(-scaleFactor) before the function returns. This helps preserve the range of the output data or its precision. Typically, scaling by positive factors is done with shift operations. The result is rounded to the nearest even integer (see Rounding Modes).
For example, if the integer Ipp16s with an input value of 200 is used for the square root, the operation result is equal to 32767 instead of 40000, that is to say, the result is saturated and the exact value cannot be recovered. Scaling the output value with a factor of scaleFactor=1 gives a result of 20000, which is not saturated and the exact value can be restored to 200002 . Therefore, the output data range is preserved.
The following example shows how to partially preserve precision by means of scaling. Integer square root of the input value 2 (without scaling) equals 1 instead of 1.414. Scaling the internally computed output value by a factor of scaleFactor = -3 gives a result of 11 and allows a more precise value to be restored to 11 2
^(-3) = 1.375.

4. Official Website Development Manual

Official website address

Guess you like

Origin blog.csdn.net/puqian13/article/details/127721450
Recommended