我要评分
获取效率
正确性
完整性
易理解

Interface Description

The interfaces of the CV image operator are the same as those of OpenCV. Table 1 lists optimized interfaces. To facilitate adaptation, Interface Definition uses OpenCV function interfaces as examples.

Table 1 Optimized interfaces

Interface

Description

cvtColor

Converts images, including the BGR2GRAY, BGR2RGB, RGB2BGR, and GRAY2BGR modes.

dilate

Dilates the target area in an image by convolving the image based on specified structure elements.

GaussianBlur

Uses the Gaussian function to perform convolution on images to smooth images and reduce noise and details.

merge

Merges three single-channel images into one three-channel image.

remap

Remaps images during image processing for geometric transforms, such as image translation, rotation, scaling, and distortion.

resize

Adjusts the image size in INTER_NEAREST_EXACT (nearest neighbor interpolation), INTER_LINEAR (bilinear interpolation, default), and INTER_CUBIC (bicubic interpolation) modes.

convertTo

Converts the data type of an image to another with optional scaling. For example, an image can be converted from 8-bit to 16-bit and scaled down at the same time.

threshold

Performs image binarization based on a threshold that divides the grayscale value of an image into two parts. Methods such as global thresholding, adaptive thresholding, and OTSU thresholding can be used.

warpAffine

Performs affine transformation such as translation, rotation, scaling, and cropping on an image using a 2x3 transformation matrix.

contourArea

Calculates the area of a contour, that is, the total number of pixels in the contour.

countNonZero

Counts the number of non-zero pixels in an image.

morphologyEx

Performs morphological operations, such as opening, closing, and gradient operations. It is used to process noise, fill holes, or enhance edge features in an image.

copyMakeBorder

Adds a border around an image. It expands the image size by filling a specific color or replicating border values to enhance the image processing effect.

bitwise_and

Performs a bitwise AND operation to combine the pixel values of two images and retains only pixel information that exists in both input images.

bitwise_or

Performs a bitwise OR operation to generate a composite image that includes at least one input image having non-zero pixels.

kcv_normalAndNCHW

Performs normalization, the result of which is used as the input of deep learning models.

t

Performs matrix transposition to swap the rows and columns of an image matrix to meet specific computing requirements.

The usage of the interfaces and involved constants are the same as those in OpenCV. To avoid tedium, this document only briefly describes some interfaces. For more information, refer to the official OpenCV documentation.