An image filtering method and device, electronic equipment and storage medium
By performing type detection on the image to be filtered and using filters with different truncation function parameters, the problem of high computational complexity of ALF is solved, and efficient image filtering is achieved.
Patent Information
- Application Number
- CN202211497888.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-25
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-11-25
AI Technical Summary
In video encoding, ALF requires four sets of truncation function parameters to filter and test the reconstructed video frames, resulting in high computational complexity.
By detecting the image to be filtered, it is distinguished into non-high edge images and high edge images. The filter is then processed using a preset truncation function parameter or a preset number of truncation function parameters to reduce computational complexity.
It reduces the computational complexity of image filtering, improves image coding efficiency, and meets the filtering effect and performance requirements of different types of images.
Smart Images

Figure CN115731133B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an image filtering method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the advancement of technology and the increasing demands for multimedia entertainment programs, the resolution and frame rate of multimedia video content have risen, leading to a continuous increase in the bandwidth and storage costs of multimedia videos. In this context, VVC (Versatile Video Coding) emerged. ALF (Adaptive Loop Filter) is one of the most effective coding tools in VVC, used to filter the reconstructed video frames obtained during video encoding.
[0003] The specific process of ALF filtering the reconstructed video frames includes: using four sets of truncation function parameters to perform filtering tests on the reconstructed video frames, and then using the truncation function parameter corresponding to the minimum distortion in the filtering test results to filter the reconstructed video frames.
[0004] Because ALF requires four sets of truncation function parameters to perform filtering tests on the reconstructed video frames, that is, to perform filtering tests on each reconstructed video frame to be filtered using four sets of truncation function parameters, the optimal truncation function parameters for filtering the reconstructed video frame to be filtered are determined, which makes the computational complexity high during the filtering process. Summary of the Invention
[0005] The purpose of this invention is to provide an image filtering method, apparatus, electronic device, and storage medium to reduce the computational complexity of image filtering. The specific technical solution is as follows:
[0006] In a first aspect of the present invention, an image filtering method is provided, the method comprising:
[0007] The type of the image to be filtered is obtained by detecting the image to be filtered.
[0008] When the type of the image to be filtered is a non-high-edge image, the image to be filtered is processed by using a filter corresponding to the preset truncation function parameters to obtain the filtered result image of the image to be filtered.
[0009] When the image to be filtered is a high-edge image, the image to be filtered is processed by using a filter corresponding to a preset number of truncation function parameters to obtain the filtered result image.
[0010] Optionally, the step of detecting the image to be filtered to obtain the type of the image to be filtered includes:
[0011] Obtain the pixel value of each pixel in the image to be filtered;
[0012] For each pixel, determine whether the pixel is an edge pixel based on the pixel value of the pixel and the pixel values of the pixels of the adjacent pixels;
[0013] Count the number of edge pixels in the image to be filtered;
[0014] If the number of edge pixels is not greater than a preset threshold, the image to be filtered is determined to be a non-high-edge image.
[0015] If the number of edge pixels is greater than a preset threshold, the image to be filtered is determined to be a high-edge image.
[0016] Optionally, when the type of the image to be filtered is a non-high-edge image, the step of filtering the image to be filtered using a filter corresponding to a preset truncation function parameter to obtain the filtered result image includes:
[0017] For each image block to be filtered in the brightness channel of the image to be filtered, determine the category of the image block to be filtered;
[0018] Based on the category of each image block to be filtered, determine the filter parameters corresponding to that image block.
[0019] For each image block to be filtered in the brightness channel of the image to be filtered, the image block to be filtered is filtered based on the filter parameters corresponding to the image block to be filtered and the preset truncation function parameters to obtain the brightness filtering result of the image block to be filtered.
[0020] Obtain the preset filter parameters of the image to be filtered in the chroma channel;
[0021] For each image block to be filtered in the chroma channel of the image to be filtered, the image block to be filtered is filtered based on the preset filter parameters and the preset truncation function parameters to obtain the chroma filtering result of the image block to be filtered.
[0022] Based on the luminance filtering results of each image block in the luminance channel and the chrominance filtering results of each image block in the chrominance channel, the filtered image of the image to be filtered is obtained.
[0023] Optionally, when the image to be filtered is a high-edge image, the step of filtering the image to be filtered using a filter corresponding to a preset number of truncation function parameters to obtain the filtered result image includes:
[0024] The image to be filtered is processed by using filters corresponding to preset number of truncation function parameters to obtain multiple filtering result parameters.
[0025] Select the truncation function parameter corresponding to the optimal filtering result parameter from the plurality of filtering result parameters, and use it as the target truncation function parameter;
[0026] The image to be filtered is processed by using the filter corresponding to the parameters of the target truncation function to obtain the filtered result image.
[0027] Optionally, the image to be filtered is processed by using filters corresponding to a preset number of truncation function parameters to obtain multiple filtering result parameters, including:
[0028] For each image block to be filtered in the brightness channel of the image to be filtered, determine the category of the image block to be filtered;
[0029] Based on the category of each image block to be filtered, determine the filter parameters corresponding to that image block.
[0030] Obtain the preset filter parameters of the image to be filtered in the chroma channel;
[0031] For each set of truncation function parameters, based on the filter parameters corresponding to each image block to be filtered in the brightness channel of the image to be filtered and the set of truncation function parameters, the image block to be filtered in the brightness channel is filtered to obtain the first filtering result parameters.
[0032] For each set of truncation function parameters, based on the preset filter parameters and the set of truncation function parameters, the image to be filtered is filtered for each image block in the chroma channel to obtain the second filtering result parameters.
[0033] Optionally, the filtering result parameters include the peak signal-to-noise ratio (PSNR) or structural similarity index (SSIM) value; the step of selecting the optimal truncation function parameter from the plurality of filtering result parameters as the target truncation function parameter includes:
[0034] At the same bitrate, the truncation function parameter corresponding to the highest PSNR value is used as the target truncation function parameter;
[0035] Alternatively, at the same code rate, the truncation function parameter corresponding to the highest SSIM value can be used as the target truncation function parameter.
[0036] In a second aspect of the invention, an image filtering apparatus is also provided, the apparatus comprising:
[0037] The image type detection module is used to detect the image to be filtered and obtain the type of the image to be filtered;
[0038] The first filtering module is used to filter the image to be filtered by using a filter corresponding to a preset truncation function parameter when the type of the image to be filtered is a non-high edge image, so as to obtain the filtered result image of the image to be filtered.
[0039] The second filtering module is used to filter the image to be filtered by using a filter corresponding to a preset number of truncation function parameters when the image to be filtered is a high-edge image, so as to obtain the filtered result image of the image to be filtered.
[0040] Optionally, the image type detection module includes:
[0041] A pixel value acquisition unit is used to acquire the pixel value of each pixel in the image to be filtered;
[0042] A pixel determination unit is used to determine whether a pixel is an edge pixel for each pixel based on the pixel value of the pixel and the pixel values of the pixels of the adjacent pixels.
[0043] A quantity counting unit is used to count the number of edge pixels in the image to be filtered;
[0044] The first determining unit is configured to determine that the type of the image to be filtered is a non-high-edge image when the number of edge pixels is not greater than a preset threshold.
[0045] The second determining unit is used to determine that the type of the image to be filtered is a high-edge image when the number of edge pixels is greater than a preset threshold.
[0046] Optionally, the first filtering module includes:
[0047] An image category determination unit is used to determine the category of each image block to be filtered in the brightness channel of the image to be filtered.
[0048] The first parameter determination unit is used to determine the filter parameters corresponding to each image block to be filtered based on the category of each image block to be filtered.
[0049] The first filtering unit is used to perform filtering processing on each image block to be filtered in the brightness channel of the image to be filtered, based on the filter parameters corresponding to the image block to be filtered and the preset truncation function parameters, to obtain the brightness filtering result of the image block to be filtered.
[0050] The second parameter determination unit is used to obtain the preset filter parameters of the image to be filtered in the chroma channel;
[0051] The second filtering unit is used to perform filtering processing on each image block to be filtered in the chroma channel of the image to be filtered based on the preset filter parameters and the preset truncation function parameters, so as to obtain the chroma filtering result of the image block to be filtered.
[0052] The filtering result determination unit is used to obtain the filtered result image of the image to be filtered based on the luminance filtering result of each image block to be filtered in the luminance channel and the chrominance filtering result of each image block to be filtered in the chrominance channel.
[0053] Optionally, the second filtering module includes:
[0054] The third filtering unit is used to filter the image to be filtered by using filters corresponding to preset number of truncation function parameters respectively, and to obtain multiple filtering result parameters.
[0055] The third parameter determination unit is used to select the truncation function parameter corresponding to the optimal filtering result parameter from the plurality of filtering result parameters, and use it as the target truncation function parameter;
[0056] The fourth filtering unit is used to filter the image to be filtered using the filter corresponding to the target truncation function parameters, so as to obtain the filtered result image of the image to be filtered.
[0057] Optionally, the third filtering unit is specifically used for:
[0058] For each image block to be filtered in the brightness channel of the image to be filtered, determine the category of the image block to be filtered;
[0059] Based on the category of each image block to be filtered, determine the filter parameters corresponding to that image block.
[0060] Obtain the preset filter parameters of the image to be filtered in the chroma channel;
[0061] For each set of truncation function parameters, based on the filter parameters corresponding to each image block to be filtered in the brightness channel of the image to be filtered and the set of truncation function parameters, the image block to be filtered in the brightness channel is filtered to obtain the first filtering result parameters.
[0062] For each set of truncation function parameters, based on the preset filter parameters and the set of truncation function parameters, the image to be filtered is filtered for each image block in the chroma channel to obtain the second filtering result parameters.
[0063] Optionally, the third parameter determining unit is specifically used for:
[0064] At the same bitrate, the truncation function parameter corresponding to the highest PSNR value is used as the target truncation function parameter;
[0065] Alternatively, at the same code rate, the truncation function parameter corresponding to the highest SSIM value can be used as the target truncation function parameter.
[0066] In a third aspect of the invention, an electronic device is also provided, comprising:
[0067] The processor, communication interface, memory, and communication bus are connected, with the processor, communication interface, and memory communicating with each other via the communication bus.
[0068] Memory, used to store computer programs;
[0069] The processor, when executing a program stored in memory, implements any of the image filtering methods described above.
[0070] In another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the image filtering methods described above.
[0071] In another aspect of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the image filtering methods described above.
[0072] This invention provides an image filtering method, apparatus, electronic device, and storage medium. The method detects the image to be filtered to determine its type. If the image is a non-high-edge image, a filter corresponding to a preset truncation function parameter is used to filter the image, resulting in a filtered image. If the image is a high-edge image, a preset number of filters corresponding to truncation function parameters are used to filter the image, resulting in a filtered image. By detecting and classifying the image to be filtered, and then using different filters corresponding to different truncation function parameters for different types of images, compared to existing technologies, it eliminates the need to use four sets of filters corresponding to truncation function parameters for each image, reducing the computational complexity of image filtering. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0074] Figure 1 A schematic diagram of VVC video encoding;
[0075] Figure 2 This is a flowchart illustrating the image filtering method in an embodiment of the present invention;
[0076] Figure 3 This is a flowchart illustrating the method for determining the type of image to be filtered in an embodiment of the present invention;
[0077] Figure 4a This is a schematic diagram of the filter shape on the brightness channel in an embodiment of the present invention;
[0078] Figure 4b This is a schematic diagram of the filter shape on the chroma channel in an embodiment of the present invention;
[0079] Figure 5 This is a schematic diagram of the process for filtering non-high edge images in an embodiment of the present invention;
[0080] Figure 6a This is a schematic diagram of vertical gradient sampling in an embodiment of the present invention;
[0081] Figure 6b This is a schematic diagram of horizontal gradient sampling in an embodiment of the present invention;
[0082] Figure 6c This is a schematic diagram of diagonal gradient sampling in an embodiment of the present invention;
[0083] Figure 6d This is another schematic diagram of diagonal gradient sampling in an embodiment of the present invention;
[0084] Figure 7 This is a schematic diagram of the high-edge image filtering process in an embodiment of the present invention;
[0085] Figure 8 This is a schematic diagram of another process for high-edge image filtering in an embodiment of the present invention;
[0086] Figure 9 This is a schematic diagram of the image filtering device in an embodiment of the present invention;
[0087] Figure 10 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0088] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.
[0089] VVC adopts the block-based hybrid video coding method from HEVC (High Efficiency Video Coding) for video encoding, such as... Figure 1 As shown, the encoding process includes: the input video frame is divided into individual image blocks to be encoded; for each image block to be encoded, the prediction block corresponding to the image block to be encoded is obtained from the reference frame (obtained through intra-frame prediction or inter-frame motion estimation / motion compensation); the image block to be encoded is subtracted from the prediction block to obtain the residual; the coefficient matrix obtained after transforming the residual is then quantized; and the quantized coefficient matrix is input into the entropy encoder for encoding. The transform can be, for example, DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform), etc.
[0090] Simultaneously, the quantized coefficient matrix undergoes inverse quantization and inverse transform processing. The residual information obtained after inverse quantization and inverse transform is superimposed with the corresponding prediction block in the predictor to obtain the reconstructed block corresponding to the image block to be encoded. Further, a loop filter is used to filter the reconstructed block, resulting in a filtered reconstructed block. This filtered reconstructed block is then decoded to obtain the prediction reference block for the image block to be encoded, which is placed in the decoded image buffer. Motion estimation / motion compensation is then performed on the prediction reference block in the decoded image buffer, and the block most similar to the image block to be encoded is found from the prediction reference block and redefined as the prediction block.
[0091] The aforementioned loop filter can be an ALF. The specific process of ALF filtering the reconstructed block includes: using four sets of truncation function parameters to perform filtering tests on the reconstructed block, and then using the truncation function parameter corresponding to the minimum distortion in the filtering test results to filter the reconstructed block.
[0092] Because ALF requires four sets of truncation function parameters to perform filtering tests on the reconstructed blocks, that is, four sets of truncation function parameters need to be tested for each reconstructed block to be filtered in order to determine the optimal truncation function parameters for filtering the reconstructed block, the computational complexity of the filtering process is high.
[0093] To address the above problems, embodiments of the present invention provide an image filtering method, apparatus, electronic device, and storage medium. An image filtering method provided by an embodiment of the present invention includes:
[0094] The type of the image to be filtered is obtained by detecting the image to be filtered.
[0095] When the type of the image to be filtered is a non-high-edge image, the image to be filtered is processed by using a filter corresponding to the preset truncation function parameters to obtain the filtered result image of the image to be filtered.
[0096] When the image to be filtered is a high-edge image, the image to be filtered is processed by using a filter corresponding to a preset number of truncation function parameters to obtain the filtered result image.
[0097] The image filtering method provided in this invention detects and classifies the images to be filtered, and then uses filters with different truncation function parameters for different types of images to be filtered. Compared with the prior art, it is not necessary to use filters with four sets of truncation function parameters for each image to be filtered, which reduces the computational complexity of video filtering.
[0098] The following is a detailed description of an image filtering method provided by an embodiment of the present invention:
[0099] This invention provides an image filtering method that can be applied to electronic devices, such as server devices, encoder devices, and filter devices. This image filtering method can also be applied to scenarios such as video encoding and image filtering.
[0100] like Figure 2 As shown, Figure 2 This is a flowchart illustrating the image filtering method in an embodiment of the present invention, including the following steps:
[0101] Step S210: Detect the image to be filtered to obtain the type of the image to be filtered.
[0102] The image to be filtered can be a reconstructed image from the video encoding process, or any image that needs to be filtered; this is not limited in the embodiments of the present invention.
[0103] In one possible implementation, a target detection model can be used to detect targets in the image to be filtered to determine the type of the image. This target detection model could be, for example, an edge detection model. The type of image to be filtered can include: a high-edge image and a non-high-edge image. Specifically, a high-edge image contains more edge pixels than a non-high-edge image.
[0104] In one example, edge detection algorithms can be used to perform edge detection on the image to be filtered in order to determine the type of the image. Exemplary edge detection algorithms include the Canny edge detection algorithm or the Laplacian edge detection operator, etc.
[0105] Step S220: When the type of the image to be filtered is a non-high-edge image, the image to be filtered is processed by using the filter corresponding to the preset truncation function parameters to obtain the filtered result image.
[0106] In this embodiment of the invention, ALF (Advanced Photon Filtering) is used to filter the image to be filtered. The truncation operation of ALF during the filtering process introduces non-linearity and reduces the impact of excessive differences between adjacent pixel values and the current pixel value in the image to be filtered, thus improving the filtering effect of ALF. When the image to be filtered is a reconstructed image in video encoding, the use of ALF filtering reduces the impact of excessive differences between adjacent pixel values and the current pixel value, resulting in better filtering and thus improving video encoding efficiency.
[0107] The truncation operation in the ALF filtering process introduces nonlinearity and also increases computational complexity. Therefore, in this embodiment of the invention, filters with different truncation function parameters are used for different types of images to be filtered, in order to reduce the computational complexity of the filtering process.
[0108] When the type of the image to be filtered is a non-high-edge image, it means that the number of edge pixel points in the image to be filtered is within a certain range. At this time, selecting a filter corresponding to a set of preset truncation function parameters and performing filtering on the image to be filtered can achieve the effect of image filtering. Among them, a set of preset truncation function parameters can be any set of truncation function parameters in ALF, or the default set of truncation function parameters in ALF. The certain range can be set according to actual needs, such as a threshold, etc.
[0109] In one example, four sets of truncation function parameters are defined respectively for the luminance channel and the chrominance channel in ALF. Among them, the truncation function parameters corresponding to the luminance channel are represented as alfClippingValues[CH_L], and the truncation function parameters corresponding to the chrominance channel are represented as alfClippingValues[CH_C]. The four sets of truncation function parameters corresponding to the luminance channel and the chrominance channel can be defined in the following way:
[0110] alfClippingValues[CH_L][0] = 1 << n_bit_depth;
[0111] alfClippingValues[CH_C][0] = 1 << n_bit_depth;
[0112] for(int n = 1; n < 4; n++){
[0113] alfClippingValues[CH_L][n] = 1 << (n_bit_depth - 2*n - 1);
[0114] alfClippingValues[CH_C][n] = 1 << (n_bit_depth - 2*n - 1);
[0115] }
[0116] Among them, alfClippingValues[CH_L][0] and alfClippingValues[CH_C][0] respectively represent the first set of truncation function parameters corresponding to the luminance channel and the chrominance channel, alfClippingValues[CH_L][n] and alfClippingValues[CH_C][n] respectively represent the nth set of truncation function parameters corresponding to the luminance channel and the chrominance channel, and << n_bit_depth represents shifting left by n bit depths.
[0117] For example, when the image to be filtered is a non-high-edge image, the image is filtered using a default set of truncation function parameters on both the luminance and chroma channels to obtain the filtered image. The default set of truncation function parameters can be 1 < <n_bit_depth。
[0118] Step S230: When the type of the image to be filtered is a high-edge image, the filter corresponding to the preset number of truncation function parameters is used to filter the image to be filtered, and the filtered result image is obtained.
[0119] When the image to be filtered is a high-edge image, it means that the number of edge pixels in the image exceeds a certain range, resulting in sharp edges. In this case, a filter corresponding to the preset number of truncation function parameters is selected to filter the image, thereby improving the filtering effect and performance. The preset number can not exceed 4.
[0120] In one example, when the image to be filtered is a high-edge image, a preset number of filters corresponding to the truncation function parameters can be used to filter the image to be filtered, and then the filter corresponding to the truncation function parameters with the best filtering effect can be selected to filter the image to be filtered, so as to obtain the filtered result image of the image to be filtered.
[0121] The image filtering method provided in this invention involves detecting and classifying the image to be filtered. For images classified as non-high-edge images, a filter corresponding to a preset truncation function parameter is used for filtering. For images classified as high-edge images, a filter corresponding to a preset number of truncation function parameters is used for filtering. This yields a filtered image, satisfying the filtering effect and performance requirements of different types of images. Compared to existing technologies, it eliminates the need to perform filtering tests on each image using four sets of filters corresponding to truncation function parameters, reducing the computational complexity of image filtering and improving image encoding efficiency.
[0122] In one possible implementation, such as Figure 3 As shown, the method for determining the type of image to be filtered in this embodiment of the invention may include the following steps:
[0123] Step S310: Obtain the pixel value of each pixel in the image to be filtered.
[0124] Step S320: For each pixel, determine whether the pixel is an edge pixel based on the pixel value of the pixel and the pixel values of the adjacent pixels.
[0125] In one example, because the pixel values of edge pixels differ significantly from those of their surrounding pixels, for each pixel in the image to be filtered, the difference between that pixel value and the pixel values of its adjacent pixels can be calculated. If the difference is greater than a preset difference, the pixel is identified as an edge pixel. The preset difference can be set according to actual needs, and adjacent pixels can include: left-right adjacent, top-bottom adjacent, diagonally adjacent, etc.
[0126] Step S330: Count the number of edge pixels in the image to be filtered.
[0127] Step S340: If the number of edge pixels is not greater than a preset threshold, determine that the type of the image to be filtered is a non-high edge image.
[0128] Step S350: If the number of edge pixels is greater than a preset threshold, the image to be filtered is determined to be a high-edge image.
[0129] If the number of edge pixels exceeds a preset threshold, it indicates that the image to be filtered contains a large number of edge-like parts. In this case, the image to be filtered is classified as a high-edge image; otherwise, it is classified as a non-high-edge image. The preset threshold can be set according to actual needs or empirical values.
[0130] By classifying the image to be filtered using the pixel value of each pixel and the pixel values of each neighboring pixel, the type of the image to be filtered can be determined. This allows for the application of filters with different truncation function parameters to different types of images.
[0131] ALF uses two types of rhomboid and centrally symmetrical filters, where the luminance channel uses... Figure 4a The 7×7 diamond filter shown uses the following for its chroma channel: Figure 4b The 5×5 diamond-shaped filter shown is... Figure 4a and Figure 4b In the filter, parameters C0, C1, ..., C12 represent the magnitude relationship of the filter coefficients. During the filtering process, the position of the filter center indicates the current pixel position participating in the filtering in the image to be filtered.
[0132] In one possible implementation, such as Figure 5 As shown, one embodiment of filtering non-high edge images in this invention may include the following steps:
[0133] Step S510: For each image block to be filtered in the brightness channel of the image to be filtered, determine the category of the image block to be filtered.
[0134] ALF is a patch-based filtering technique. When filtering an image, it is first divided into multiple patch images, each with a pixel size, such as 4x4. Different filters are used for different types of patch images. Furthermore, when filtering each patch, its category is first determined.
[0135] ALF categorizes the image blocks to be filtered into 25 classes based on directionality and activity values. Image blocks within the same class are filtered using the same filter. For the luma channel, a maximum of 25 filter coefficients correspond to each image block. For the chroma channel, there is no need to classify the image blocks; the same set of filter parameters is used. For example, when using ALF in video encoding, the encoder needs to transmit a total of 25 sets of filter coefficients. All filter coefficients can be stored in the slice header and transmitted to the decoder.
[0136] For example, for each image block to be filtered in the luminance channel, the category Idx (index) of the image block to be filtered can be calculated as follows:
[0137] C = 5D + A
[0138] Where C represents the category index corresponding to the image patch to be filtered, and D and A represent the direction and activity values of the image patch to be filtered, respectively.
[0139] Before calculating the category of the image patch to be filtered, the gradient values of the image patch in the horizontal, vertical and two diagonal directions can be calculated using a one-dimensional Laplacian operator. The calculation expressions used are as follows:
[0140]
[0141]
[0142]
[0143]
[0144] Where (i,j) represents the coordinates of the top-left pixel of the image block to be filtered, R(i,j) represents the pixel value at coordinates (i,j), and V k,l H represents the gradient value in the vertical direction of the pixel located at coordinates (k,l) in the image block to be filtered. k,l R(k,l) represents the horizontal gradient value of the pixel located at coordinates (k,l) in the image block to be filtered, and D1 represents the pixel value located at coordinates (k,l) in the image block to be filtered. k,lD2 represents the gradient value of the pixel at coordinates (k,l) in the image block to be filtered, in a diagonal direction. k,l This represents the gradient value of the pixel at coordinates (k, l) in the image block to be filtered in the opposite diagonal direction; g v This represents the gradient value of the image patch to be filtered in the vertical direction; g h g represents the gradient value of the image patch to be filtered in the horizontal direction. d1 This represents the gradient value of the image patch to be filtered in a diagonal direction; g d2 This represents the gradient value of the image block to be filtered in the other diagonal direction.
[0145] To reduce the complexity of classifying the image patches to be filtered, the one-dimensional Laplacian operator described in this embodiment of the invention may employ a downsampling-based one-dimensional Laplacian calculation, using the same downsampling position for gradient calculation in all four directions. For example, the subsampling position on the vertical gradient is as follows: Figure 6a As shown, the subsampling positions on the horizontal gradient are as follows: Figure 6b As shown, the subsampling positions on a diagonal gradient are as follows: Figure 6c As shown, the subsampling positions on another diagonal gradient are as follows: Figure 6d As shown.
[0146] The maximum value of D (directivity) of the image patch to be filtered in the horizontal and vertical directions. and minimum value They can be represented as:
[0147]
[0148] The maximum value of D in the diagonal direction of the image patch to be filtered and minimum value They can be represented as:
[0149]
[0150] To obtain the value of the directionality D of the image block to be filtered, the above-mentioned... as well as The values of the image block D to be filtered are then compared and calculated.
[0151] For example, the value of the image block D to be filtered can be determined in the following way:
[0152]
[0153] Where t1 and t2 are preset thresholds.
[0154] For example, the activity value A of the image patch to be filtered can be calculated using the following expression:
[0155]
[0156] Normalizing A to the range [0,4] yields the quantized A(A) q ).
[0157] A q =24×A>>13
[0158] After calculating the directionality D and activity value A of the image patch to be filtered, the category corresponding to the image patch can be determined by the above expression C = 5D + A. For example, the values of D are 0, 1, 2, 3, 4, and the values of A are also 0, 1, 2, 3, 4. Therefore, the value of C ranges from 0 to 24, which is 25 categories.
[0159] See Figure 5 Step S520: Determine the filter parameters corresponding to each image block to be filtered based on its category.
[0160] In one example, all filter coefficients are stored in the slice header. After determining the category of each image patch to be filtered, the filter parameters corresponding to that category can be further determined from the filter coefficients. For instance, the slice header stores the correspondence between image patch categories and filter coefficients. Therefore, once the category of the image patch to be filtered is determined, the corresponding filter parameters can be determined by directly querying the correspondence.
[0161] Step S530: For each image block to be filtered in the brightness channel of the image to be filtered, based on the filter parameters corresponding to the image block and the preset truncation function parameters, the image block to be filtered is filtered to obtain the brightness filtering result of the image block to be filtered.
[0162] After determining the filter parameters corresponding to the image block to be filtered on the brightness channel, the image block to be filtered is filtered by combining the filter parameters corresponding to the image block to be filtered and the preset truncation function parameters to obtain the brightness filtering result of the image block to be filtered.
[0163] For example, the image block to be filtered can be processed using the following expression:
[0164]
[0165] R(i,j) represents the pixel value at coordinate (i,j), R′(i,j) represents the pixel value after filtering R(i,j), f(p,w) represents the filter coefficients, p and w represent the coordinates of the filter coefficients; K(x,y) represents the truncation function, and c(p,w) represents the parameters of the truncation function.
[0166] The truncation function is defined as: K(x,y)=lip3(-y,y,x), which means truncating x between (-,y).
[0167] Step S540: Obtain the preset filter parameters of the image to be filtered in the chroma channel.
[0168] ALF does not require classifying the image blocks to be filtered in the chroma channel; that is, each image block to be filtered in the chroma channel uses the same set of filter parameters. The preset filter parameters are the same set of filter parameters used by each image block to be filtered in the chroma channel.
[0169] Step S550: For each image block to be filtered in the chroma channel of the image to be filtered, based on preset filter parameters and preset truncation function parameters, the image block to be filtered is filtered to obtain the chroma filtering result of the image block to be filtered.
[0170] For each image block to be filtered in the chroma channel, the filtering method for each image block to be filtered in the luminance channel can be used as a reference, except that the filter parameters for each image block to be filtered are different.
[0171] Steps S510-S530 and steps S540-S550 can be executed synchronously or asynchronously.
[0172] Step S560: Based on the luminance filtering result of each image block to be filtered in the luminance channel and the chrominance filtering result of each image block to be filtered in the chrominance channel, the filtered result image of the image to be filtered is obtained.
[0173] In one example, the luminance filtering result of each image block to be filtered in the luminance channel and the chroma filtering result of each image block to be filtered in the chroma channel can be used to determine the filtered image as the final image. Alternatively, the filtering results obtained by filtering each image block to be filtered in the luminance and chroma channels can be weighted and summed to obtain the filtered image.
[0174] For images with non-high edges, a set of preset truncation function parameters are used, combined with the filter parameters of each image block to be filtered in the luminance and chrominance channels, to perform filtering processing on each image block to be filtered, so as to obtain the filtered result image, thereby reducing the computational complexity in the filtering process of the image to be filtered.
[0175] In one possible implementation, such as Figure 7As shown, one embodiment of filtering high-edge images in this invention may include the following steps:
[0176] Step S710: The filter corresponding to the preset number of truncation function parameters is used to filter the image to be filtered, and multiple filtering result parameters are obtained.
[0177] In one example, the preset number of truncation function parameters represents four sets of truncation function parameters defined for the luminance and chrominance channels in ALF, respectively. When the image to be filtered is a high-edge image, the filters corresponding to the four sets of truncation function parameters are used to filter the image, resulting in multiple filtered parameter values.
[0178] Step S720: Select the truncation function parameter corresponding to the optimal filter result parameter from multiple filter result parameters, and use it as the target truncation function parameter.
[0179] In one possible implementation, the filtering result parameters may include PSNR (Peak Signal to Noise Ratio) values or SSIM (Structural Similarity) values.
[0180] Accordingly, selecting the truncation function parameter corresponding to the optimal filtering result parameter from multiple filtering result parameters as the target truncation function parameter can include: under the same bit rate, using the truncation function parameter corresponding to the highest PSNR value as the target truncation function parameter; or, under the same bit rate, using the truncation function parameter corresponding to the highest SSIM value as the target truncation function parameter.
[0181] SSIM is a metric for measuring the similarity between two images, which measures image similarity by considering three aspects: brightness, contrast, and structure. PSNR can be used to quantify the reconstruction quality of images and videos affected by lossy compression. PSNR can be luminance PSNR or a linear combination of luminance and chrominance PSNR.
[0182] For example, the image to be filtered is a reconstructed image in video coding. Therefore, for each image to be filtered, the PSNR or SSIM values obtained after filtering with filters corresponding to four sets of truncation function parameters can be compared. During video coding, the truncation function parameter with the highest PSNR or SSIM value at the same bitrate is selected as the target truncation function parameter. Here, the PSNR or SSIM value for each image to be filtered represents the PSNR or SSIM value between the filtered image and the original image corresponding to that image. At the same bitrate, a higher PSNR or SSIM value indicates a better filtering effect, and thus the set of truncation function parameters with the best filtering effect is selected as the target truncation function parameter.
[0183] Using PSNR or SSIM values as the basis for selecting truncation function parameters allows for the rapid selection of the set of truncation function parameters that provide the best filtering effect. These parameters can then be used as the target truncation function parameters to better filter the image.
[0184] Step S730: Use the filter corresponding to the target truncation function parameter to filter the image to be filtered, and obtain the filtered result image of the image to be filtered.
[0185] In one example, after determining the truncation function parameters corresponding to the image to be filtered, the image to be filtered can be filtered by referring to the implementation process of steps S510 to S560 above, so as to obtain the filtered result image. The embodiments of the present invention will not be described in detail here.
[0186] When the image to be filtered is a high-edge image, four sets of filters corresponding to truncation function parameters are used to filter the image to obtain multiple filtering result parameters. Then, the optimal truncation function parameter corresponding to the multiple filtering result parameters is selected as the target truncation function parameter. The filter corresponding to the target truncation function parameter is then used to filter the image to improve the filtering effect.
[0187] In one possible implementation, such as Figure 8 As shown, another implementation of filtering high-edge images in this embodiment of the invention may include the following steps:
[0188] Step S810: For each image block to be filtered in the brightness channel of the image to be filtered, determine the category of the image block to be filtered.
[0189] Step S820: Determine the filter parameters corresponding to each image block to be filtered based on its category.
[0190] Step S830: Obtain the preset filter parameters of the image to be filtered in the chroma channel.
[0191] The implementation process of steps S810 to S830 can be referred to the implementation process of steps S510, S520 and S540 above, and will not be repeated here in this embodiment of the invention. Steps S810-S820 and step S830 can be executed synchronously or asynchronously.
[0192] Step S840: For each set of truncation function parameters, based on the filter parameters corresponding to each image block to be filtered in the brightness channel of the image to be filtered and the set of truncation function parameters, filter processing is performed on each image block to be filtered in the brightness channel of the image to be filtered to obtain the first filtering result parameters.
[0193] Iterate through each set of truncation function parameters. For each set of truncation function parameters, use the filter parameters corresponding to each image block to be filtered in the brightness channel of the image to be filtered, as well as the set of truncation function parameters, to perform filtering processing on each image block to be filtered, so as to obtain the brightness filtering result of each image block to be filtered, and the first filtering result parameters of the image to be filtered.
[0194] In one example, a set of truncation function parameters corresponds to a first filtering result parameter. This first filtering result parameter can be the mean, sum, or weighted value of the PSNR or SSIM values between the brightness filtering result of each image block to be filtered and the corresponding original image block. Alternatively, the first filtering result parameter can be the mean, sum, or weighted value of the PSNR or SSIM values between the brightness filtering result of the image to be filtered and the corresponding original image, where the brightness filtering result of the image to be filtered can be obtained by merging the brightness filtering results of each image block to be filtered.
[0195] Step S850: For each set of truncation function parameters, based on the preset filter parameters and the set of truncation function parameters, filter each image block to be filtered in the chroma channel of the image to be filtered to obtain the second filtering result parameters.
[0196] The algorithm iterates through each set of truncation function parameters. For each set of truncation function parameters, it uses a set of preset filter parameters and the set of truncation function parameters to perform filtering on each image block to obtain the chroma filtering result of each image block and the second filtering result parameters of the image to be filtered. The set of preset filter parameters consists of the filter parameters corresponding to the image to be filtered on the chroma channel.
[0197] In one example, a set of truncation function parameters corresponds to a second filtering result parameter. This second filtering result parameter can be the mean, sum, or weighted value of the PSNR or SSIM values between the chroma filtering result of each image block to be filtered and the corresponding original image block. Alternatively, the second filtering result parameter can be the mean, sum, or weighted value of the PSNR or SSIM values between the chroma filtering result of the image to be filtered and the corresponding original image, where the chroma filtering result of the image to be filtered can be obtained by merging the chroma filtering results of each image block to be filtered.
[0198] For each set of truncation function parameters, based on the filter parameters corresponding to each image block to be filtered in the luminance channel of the image to be filtered and the set of truncation function parameters, filtering is performed on each image block to be filtered in the luminance channel of the image to be filtered to obtain the first filtering result parameters. Based on the preset filter parameters and the set of truncation function parameters, filtering is performed on each image block to be filtered in the chroma channel of the image to be filtered to obtain the second filtering result parameters. This allows for the selection of the optimal truncation function parameters corresponding to the multiple filtering result parameters to further filter the image to be filtered.
[0199] For example, when the image to be filtered is a non-high-edge image, a set of filters corresponding to preset truncation function parameters is used to filter the image to obtain the filtered result image. When the image to be filtered is a high-edge image, four sets of filters corresponding to truncation function parameters are used to filter the image to be filtered, and the set of filters corresponding to the truncation function parameters with the best filtering effect is selected to filter the image to obtain the filtered result image. Compared with using all four sets of filters corresponding to truncation function parameters, filtering the image to be filtered improves the encoder's coding efficiency by 1.31 times, while reducing coding loss. With PSNR value alignment, the bitrate increases by 0.685%, and with SSIM value alignment, the bitrate increases by 0.54%. That is, the image filtering method of this embodiment reduces the computational complexity of image filtering and improves the image coding efficiency.
[0200] Based on the same inventive concept, an image filtering device is provided corresponding to the image filtering method, such as... Figure 9 As shown, Figure 9 This is a schematic diagram of the structure of an image filtering device in an embodiment of the present invention. The device includes:
[0201] Image type detection module 910 is used to detect the image to be filtered and obtain the type of the image to be filtered;
[0202] The first filtering module 920 is used to filter the image to be filtered by using a filter corresponding to a preset truncation function parameter when the type of the image to be filtered is a non-high edge image, so as to obtain the filtered result image of the image to be filtered.
[0203] The second filtering module 930 is used to filter the image to be filtered by using a filter corresponding to a preset number of truncation function parameters when the type of the image to be filtered is a high-edge image, so as to obtain the filtered result image of the image to be filtered.
[0204] The image filtering device provided in this embodiment of the invention detects and classifies the images to be filtered, and then uses filters corresponding to different truncation function parameters to filter different types of images. Compared with the prior art, it is not necessary to use filters corresponding to 4 sets of truncation function parameters for each image to be filtered, which reduces the computational complexity of image filtering.
[0205] In one possible implementation, the image type detection module includes:
[0206] A pixel value acquisition unit is used to acquire the pixel value of each pixel in the image to be filtered;
[0207] A pixel determination unit is used to determine whether a pixel is an edge pixel for each pixel based on the pixel value of the pixel and the pixel values of the pixels of the adjacent pixels.
[0208] A quantity counting unit is used to count the number of edge pixels in the image to be filtered;
[0209] The first determining unit is configured to determine that the type of the image to be filtered is a non-high-edge image when the number of edge pixels is not greater than a preset threshold.
[0210] The second determining unit is used to determine that the type of the image to be filtered is a high-edge image when the number of edge pixels is greater than a preset threshold.
[0211] In one possible implementation, the first filtering module includes:
[0212] An image category determination unit is used to determine the category of each image block to be filtered in the brightness channel of the image to be filtered.
[0213] The first parameter determination unit is used to determine the filter parameters corresponding to each image block to be filtered based on the category of each image block to be filtered.
[0214] The first filtering unit is used to perform filtering processing on each image block to be filtered in the brightness channel of the image to be filtered, based on the filter parameters corresponding to the image block to be filtered and the preset truncation function parameters, to obtain the brightness filtering result of the image block to be filtered.
[0215] The second parameter determination unit is used to obtain the preset filter parameters of the image to be filtered in the chroma channel;
[0216] The second filtering unit is used to perform filtering processing on each image block to be filtered in the chroma channel of the image to be filtered based on the preset filter parameters and the preset truncation function parameters, so as to obtain the chroma filtering result of the image block to be filtered.
[0217] The filtering result determination unit is used to obtain the filtered result image of the image to be filtered based on the luminance filtering result of each image block to be filtered in the luminance channel and the chrominance filtering result of each image block to be filtered in the chrominance channel.
[0218] In one possible implementation, the second filtering module includes:
[0219] The third filtering unit is used to filter the image to be filtered by using filters corresponding to preset number of truncation function parameters respectively, and to obtain multiple filtering result parameters.
[0220] The third parameter determination unit is used to select the truncation function parameter corresponding to the optimal filtering result parameter from the plurality of filtering result parameters, and use it as the target truncation function parameter;
[0221] The fourth filtering unit is used to filter the image to be filtered using the filter corresponding to the target truncation function parameters, so as to obtain the filtered result image of the image to be filtered.
[0222] In one possible implementation, the third filtering unit is specifically used for:
[0223] For each image block to be filtered in the brightness channel of the image to be filtered, determine the category of the image block to be filtered;
[0224] Based on the category of each image block to be filtered, determine the filter parameters corresponding to that image block.
[0225] Obtain the preset filter parameters of the image to be filtered in the chroma channel;
[0226] For each set of truncation function parameters, based on the filter parameters corresponding to each image block to be filtered in the brightness channel of the image to be filtered and the set of truncation function parameters, the image block to be filtered in the brightness channel is filtered to obtain the first filtering result parameters.
[0227] For each set of truncation function parameters, based on the preset filter parameters and the set of truncation function parameters, the image to be filtered is filtered for each image block in the chroma channel to obtain the second filtering result parameters.
[0228] In one possible implementation, the third parameter determining unit is specifically used for:
[0229] At the same bitrate, the truncation function parameter corresponding to the highest PSNR value is used as the target truncation function parameter;
[0230] Alternatively, at the same code rate, the truncation function parameter corresponding to the highest SSIM value can be used as the target truncation function parameter.
[0231] This invention also provides an electronic device, such as... Figure 10 As shown, it includes a processor 101, a communication interface 102, a memory 103, and a communication bus 104, wherein the processor 101, the communication interface 102, and the memory 103 communicate with each other through the communication bus 104.
[0232] Memory 103 is used to store computer programs;
[0233] When processor 101 executes a program stored in memory 103, it performs the following steps:
[0234] The type of the image to be filtered is obtained by detecting the image to be filtered.
[0235] When the type of the image to be filtered is a non-high-edge image, the image to be filtered is processed by using a filter corresponding to the preset truncation function parameters to obtain the filtered result image of the image to be filtered.
[0236] When the image to be filtered is a high-edge image, the image to be filtered is processed by using a filter corresponding to a preset number of truncation function parameters to obtain the filtered result image.
[0237] The electronic device provided in this invention detects and classifies images to be filtered, and then uses filters corresponding to different truncation function parameters to filter different types of images to be filtered. Compared with the prior art, it is not necessary to use filters corresponding to 4 sets of truncation function parameters for each image to be filtered, which reduces the computational complexity of image filtering.
[0238] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0239] The communication interface is used for communication between the aforementioned terminal and other devices.
[0240] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0241] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0242] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the image filtering methods described in the above embodiments.
[0243] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the image filtering methods described in the above embodiments.
[0244] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0245] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0246] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device / electronic device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0247] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. An image filtering method, characterized by, The method comprises: detecting a to-be-filtered image to obtain a type of the to-be-filtered image; in a case where the type of the to-be-filtered image is a non-high-edge image, performing filtering processing on the to-be-filtered image by using a filter corresponding to a preset set of truncation function parameters to obtain a result image filtered from the to-be-filtered image; in a case where the type of the to-be-filtered image is a high-edge image, performing filtering processing on the to-be-filtered image by using filters corresponding to a preset number of sets of truncation function parameters to obtain a result image filtered from the to-be-filtered image, comprising: performing filtering processing on the to-be-filtered image by using filters corresponding to the preset number of sets of truncation function parameters respectively to obtain a plurality of filtering result parameters; selecting, from the plurality of filtering result parameters, truncation function parameters corresponding to an optimal filtering result parameter as target truncation function parameters; and performing filtering processing on the to-be-filtered image by using a filter corresponding to the target truncation function parameters to obtain the result image filtered from the to-be-filtered image; wherein a number of edge pixel points contained in the non-high-edge image is not greater than a preset threshold; and a number of edge pixel points contained in the high-edge image is greater than the preset threshold.
2. The method of claim 1, wherein, The detection of the to-be-filtered image to obtain the type of the to-be-filtered image comprises: obtaining pixel values of each pixel point in the to-be-filtered image; for each pixel point, determining whether the pixel point is an edge pixel point based on the pixel value of the pixel point and pixel values of adjacent pixel points of the pixel point; counting a number of edge pixel points in the to-be-filtered image; in a case where the number of edge pixel points is not greater than a preset threshold, determining that the type of the to-be-filtered image is a non-high-edge image; in a case where the number of edge pixel points is greater than the preset threshold, determining that the type of the to-be-filtered image is a high-edge image.
3. The method of claim 1, wherein, The filtering processing on the to-be-filtered image by using the filter corresponding to the preset set of truncation function parameters to obtain the result image filtered from the to-be-filtered image in a case where the type of the to-be-filtered image is the non-high-edge image comprises: determining a category of each to-be-filtered image block on a luminance channel of the to-be-filtered image; determining filter parameters corresponding to each to-be-filtered image block according to the category of the to-be-filtered image block; performing filtering processing on each to-be-filtered image block on the luminance channel of the to-be-filtered image based on the filter parameters corresponding to the to-be-filtered image block and the preset set of truncation function parameters to obtain a luminance filtering result of the to-be-filtered image block; obtaining preset filter parameters on a chroma channel of the to-be-filtered image; performing filtering processing on each to-be-filtered image block on the chroma channel of the to-be-filtered image based on the preset filter parameters and the preset set of truncation function parameters to obtain a chroma filtering result of the to-be-filtered image block; The filtering result image of the to-be-filtered image is obtained based on the brightness filtering result of each to-be-filtered image block on the brightness channel of the to-be-filtered image and the chroma filtering result of each to-be-filtered image block on the chroma channel of the to-be-filtered image.
4. The method of claim 1, wherein, The to-be-filtered image is filtered by using the filters corresponding to the preset number of groups of clipping function parameters respectively, to obtain a plurality of filtering result parameters, including: For each to-be-filtered image block on the brightness channel of the to-be-filtered image, the category of the to-be-filtered image block is determined; According to the category of each to-be-filtered image block, the filter parameter corresponding to the to-be-filtered image block is determined; A preset filter parameter on the chroma channel of the to-be-filtered image is obtained; For each group of clipping function parameters, the to-be-filtered image block on the brightness channel of the to-be-filtered image is filtered based on the filter parameter corresponding to the to-be-filtered image block and the group of clipping function parameters, to obtain a first filtering result parameter; For each group of clipping function parameters, the to-be-filtered image block on the chroma channel of the to-be-filtered image is filtered based on the preset filter parameter and the group of clipping function parameters, to obtain a second filtering result parameter.
5. The method of claim 1, wherein, The filtering result parameter includes a peak signal-to-noise ratio (PSNR) value or a structural similarity (SSIM) value; The target clipping function parameter is selected from the plurality of filtering result parameters, including: Under the same code rate, the clipping function parameter corresponding to the highest PSNR value is selected as the target clipping function parameter; Or, under the same code rate, the clipping function parameter corresponding to the highest SSIM value is selected as the target clipping function parameter.
6. An image filtering apparatus characterized by comprising: The device includes: An image type detection module is configured to detect a to-be-filtered image to obtain a type of the to-be-filtered image; A first filtering module is configured to, when the type of the to-be-filtered image is a non-high-edge image, filter the to-be-filtered image by using a filter corresponding to a group of preset clipping function parameters to obtain a filtered result image of the to-be-filtered image; A second filtering module is configured to, when the type of the to-be-filtered image is a high-edge image, filter the to-be-filtered image by using filters corresponding to a preset number of groups of clipping function parameters to obtain a filtered result image of the to-be-filtered image; The number of edge pixel points included in the non-high-edge image is not greater than a preset threshold, and the number of edge pixel points included in the high-edge image is greater than the preset threshold; The second filtering module includes: A third filtering unit is configured to filter the to-be-filtered image by using filters corresponding to a preset number of groups of clipping function parameters respectively to obtain a plurality of filtering result parameters; A third parameter determination unit is configured to select, from the plurality of filtering result parameters, a clipping function parameter corresponding to an optimal filtering result parameter as a target clipping function parameter. A fourth filtering unit is configured to filter the to-be-filtered image by using a filter corresponding to the target truncation function parameter, to obtain a filtered result image of the to-be-filtered image.
7. An electronic device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is configured to store a computer program. The processor is configured to execute the program stored in the memory, and implement the method steps in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps in any one of claims 1-5.
Citation Information
Patent Citations
Deblocking filtering
CN103299632A
System and method for filter design and usage thereof
CN106464633A