Image coding method and device and electronic equipment

By obtaining and using the contour mask image to enhance the original image, combined with the adaptive coding method, the contradiction between image coding quality improvement and coding time reduction in the existing technology is solved, and efficient image coding effect is achieved.

CN118694950APending Publication Date: 2024-09-24BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410788358.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Existing image coding technology is difficult to reduce encoding time while improving image quality, resulting in a decrease in encoding speed and unable to achieve a double-optimal effect.

Method used

By obtaining the contour mask image of the original image, enhancing it, combining the contour mask image and the enhanced image, obtaining the encoding code stream and reconstructed image, an adaptive encoding method is used to improve image quality and compression rate, and reduce encoding time.

Benefits of technology

It improves image quality and compression rate, improves image coding efficiency, and achieves a double-optimal effect, which not only improves image quality but also reduces coding time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694950A
    Figure CN118694950A
Patent Text Reader

Abstract

The invention provides an image coding method and device and electronic equipment, and relates to the technical field of artificial intelligence, in particular to the technical fields of image processing, deep learning and the like, and the method comprises the steps: obtaining a contour mask image of an original image; enhancing the original image according to the contour mask image to obtain an enhanced image; and according to the contour mask image and the enhanced image, obtaining a coding code stream and a reconstructed image of the original image. Therefore, the contour mask image of the original image is acquired, and the encoding code stream and the reconstructed image of the original image are acquired according to the contour mask image and the enhanced image, so that the quality and the compression ratio of the image are improved, the encoding time of the image is shortened, and the encoding efficiency of the image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as image processing and deep learning, and in particular to an image encoding method, device and electronic device. Background Art

[0002] In the related technologies, high-efficiency video coding (HEVC) is mostly used for image coding to obtain a higher compression rate. However, in practical applications, due to the uneven quality and unclear edges of the original images, directly encoding the original images does not significantly improve the quality of the main image. At the same time, the new coding standard has many division modes, which improves the performance while greatly reducing the encoding speed, and cannot achieve the dual-optimization effect. Therefore, how to improve the image quality after image encoding and reduce the image encoding time has become an urgent problem to be solved. Summary of the invention

[0003] The present disclosure proposes an image encoding method, an apparatus, an electronic device, a storage medium and a computer program product.

[0004] According to the first aspect of the present disclosure, an image encoding method is proposed, comprising: obtaining a contour mask image of an original image; enhancing the original image according to the contour mask image to obtain an enhanced image; and obtaining a coded code stream and a reconstructed image of the original image according to the contour mask image and the enhanced image.

[0005] According to a second aspect of the present disclosure, an image encoding device is proposed, comprising: a first acquisition module, used to acquire a contour mask image of an original image; an enhancement module, used to enhance the original image according to the contour mask image to obtain an enhanced image; and a second acquisition module, used to acquire a coded code stream and a reconstructed image of the original image according to the contour mask image and the enhanced image.

[0006] According to the third aspect of the present disclosure, an electronic device is proposed, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the image encoding method proposed in the first aspect above.

[0007] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is proposed, wherein the computer instructions are used to enable the computer to execute the image encoding method proposed in the first aspect above.

[0008] According to a fifth aspect of the present disclosure, a computer program product is proposed, including a computer program, wherein when the computer program is executed by a processor, the image encoding method proposed in the first aspect is implemented.

[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0011] Figure 1 A schematic diagram of a flow chart of an image encoding method according to an embodiment of the present disclosure;

[0012] Figure 2 A schematic diagram of a flow chart of an image encoding method according to another embodiment of the present disclosure;

[0013] Figure 3 A schematic diagram of a flow chart of an image encoding method according to another embodiment of the present disclosure;

[0014] Figure 4 A schematic diagram of a flow chart of an image encoding method according to an embodiment of the present disclosure;

[0015] Figure 5 is a schematic diagram of a partitioning mode according to an embodiment of the present disclosure;

[0016] Figure 6 is a schematic structural diagram of an image encoding device according to an embodiment of the present disclosure;

[0017] Figure 7 A schematic block diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0018] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0019] Artificial Intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.

[0020] Image processing is a technique that uses computers to analyze images to achieve the desired results. It is also called image processing. Image processing generally refers to digital image processing. A digital image is a large two-dimensional array obtained by shooting with industrial cameras, video cameras, scanners and other equipment. The elements of the array are called pixels, and their values ​​are called grayscale values. Image processing techniques generally include image compression, enhancement and restoration, matching, description and recognition of individual parts.

[0021] Deep learning (DL) is a new research direction in the field of machine learning (ML). It is introduced into machine learning to make it closer to the original goal - artificial intelligence. Deep learning is to learn the inherent laws and representation levels of sample data. The information obtained in the learning process is very helpful for the interpretation of data such as text, images and sounds. Its ultimate goal is to enable machines to have analytical learning capabilities like humans and to recognize data such as text, images and sounds.

[0022] Figure 1 FIG. 1 is a flow chart of an image encoding method according to an embodiment of the present disclosure. Figure 1 As shown, the method includes:

[0023] S101, obtaining a contour mask image of an original image.

[0024] It should be noted that the execution subject of the image encoding method of the embodiment of the present disclosure may be a hardware device with data image encoding capability and / or the necessary software required to drive the hardware device to work. Optionally, the execution subject may include a workstation, a server, a computer, a user terminal and other intelligent devices. Among them, the user terminal includes but is not limited to a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, etc.

[0025] The original image may be any image to be encoded.

[0026] It should be noted that the present disclosure does not limit the specific method for obtaining the original image, which can be selected according to actual conditions.

[0027] Optionally, a video source SRC to be encoded may be obtained, and after decoding and frame extraction and other processing are performed on the video source SRC to be encoded, images are obtained frame by frame, and any frame of the image may be used as the original image.

[0028] When obtaining the video source SRC to be encoded, a video resource file stored on the server may be obtained, and the obtained video resource file is used as the video source SRC to be encoded.

[0029] In the embodiment of the present disclosure, after the original image is acquired, a contour mask image of the original image may be acquired.

[0030] Optionally, the original image may be downsampled in brightness to obtain a downsampled image, and the contour mask image may be obtained according to the downsampled image.

[0031] In image processing, down sampling generally refers to reducing the size or resolution of an image.

[0032] In the embodiment of the present disclosure, after the down-sampled image is acquired, edge contour information of the down-sampled image may be acquired, and a contour mask image MASK may be acquired based on the edge contour information.

[0033] In the embodiment of the present disclosure, after the contour mask image is acquired, an idle target cache node may be determined from the cache pool, and the contour mask image may be cached on the target cache node.

[0034] S102, enhancing the original image according to the contour mask image to obtain an enhanced image.

[0035] In the embodiment of the present disclosure, after the contour mask image is acquired, the original image may be adaptively enhanced according to the contour mask image to obtain an enhanced image ENHANCE.

[0036] Optionally, for each original pixel point of the original image, a contour pixel point corresponding to the original pixel point in the contour mask image can be obtained, and the original pixel point can be enhanced and filtered according to the original pixel point and the contour pixel point to obtain the enhanced pixel point corresponding to the original pixel point, and the enhanced image ENHANCE can be obtained according to the enhanced pixel point corresponding to each original pixel point.

[0037] S103, obtaining a coded bitstream of the original image and a reconstructed image according to the contour mask image and the enhanced image.

[0038] It should be noted that after obtaining the contour mask image and the enhanced image, the contour mask image and the enhanced image can be used as input of the encoder to perform partition pattern-aware adaptive encoding to obtain the encoded bitstream of the original image and the reconstructed image.

[0039] Optionally, the enhanced image can be divided to obtain several first-layer coding blocks of the enhanced image, and the division is performed layer by layer starting from the first-layer coding blocks, and the coding blocks of the current layer are predicted. For the coding blocks of the current layer, the target division mode of the coding blocks of the current layer is determined according to the contour mask image, and the division is continued according to the target division mode until the last layer, and the optimal division mode is determined according to the prediction information of the coding blocks of each layer, and the subsequent encoding process is executed on the coding blocks corresponding to the optimal division mode to obtain the encoded code stream and the reconstructed image.

[0040] In the embodiment of the present disclosure, in response to the completion of encoding of the original image, the contour mask image is deleted from the target cache node to release the target cache node.

[0041] The image coding method proposed in the present disclosure obtains a contour mask image of the original image, enhances the original image according to the contour mask image, obtains an enhanced image, and obtains a coded code stream and a reconstructed image of the original image according to the contour mask image and the enhanced image. Therefore, the present disclosure improves the image quality and compression rate, reduces the image coding time, and improves the image coding efficiency by obtaining a contour mask image of the original image, and obtaining a coded code stream and a reconstructed image of the original image according to the contour mask image and the enhanced image.

[0042] Figure 2 It is a flowchart of an image encoding method according to the second embodiment of the present disclosure.

[0043] like Figure 2 As shown, in Figure 1 Based on the illustrated embodiment, the image encoding method of the embodiment of the present disclosure may specifically include the following steps:

[0044] The step S101 of “obtaining a contour mask image of the original image” in the above embodiment may specifically include the following steps S201 and S202 .

[0045] S201, down-sample the brightness of the original image to obtain a down-sampled image.

[0046] It should be noted that downsampling the brightness (luminance component) of the original image means reducing the resolution of the brightness component.

[0047] Optionally, a downsampling resolution (1 / T*1 / T) may be preset, and the brightness of the original image may be downsampled according to the preset downsampling resolution to obtain a downsampled image.

[0048] It should be noted that the present disclosure does not limit the setting of the downsampling resolution, which can be set according to actual conditions. For example, the downsampling resolution can be pre-set to 1 / 2*1 / 2, 1 / 4*1 / 4, 1 / 8*1 / 8, etc.

[0049] For example, for a preset downsampling resolution of 1 / 2*1 / 2, the 1 / 2*1 / 2 downsampling calculation formula can be used to downsample the brightness of the original image to obtain a downsampled image:

[0050] down[x]=((((src0[2x]+src0[2x+1]+1)>>1)+((src1[2x]+src1[2x+1]+1)>>1)+1)>>1)

[0051] Where down[x] is the downsampled image, src0[2x] and src0[2x+1] are two adjacent pixels in the first row of the original image, and src1[2x] and src1[2x+1] are two adjacent pixels in the second row of the original image, which are vertically aligned with the two adjacent pixels in the first row of the original image.

[0052] S202: Obtain a contour mask image according to the down-sampled image.

[0053] In the embodiment of the present disclosure, after the down-sampled image is acquired, edge contour information of the down-sampled image may be acquired according to the down-sampled image, and a contour mask image MASK may be acquired according to the edge contour information.

[0054] Optionally, a binary image of the downsampled image may be obtained, and connected regions may be extracted from the binary image, and edge contour detection may be performed on the connected regions to obtain edge contour information.

[0055] For example, the Otsu algorithm can be used to determine the binary segmentation threshold of the downsampled image, and the downsampled image can be normalized into a binary image based on the binary segmentation threshold. The connected area can then be extracted from the binary image using the hole scanning algorithm, and the edge contour detection algorithm can be used to perform edge contour detection on the connected area to obtain edge contour information.

[0056] Optionally, a binarized image of the downsampled image may be obtained, and a pixel gradient of the binarized image may be obtained, and edge contour information may be obtained according to the pixel gradient.

[0057] For example, the downsampled image may be binarized to obtain a binarized image of the downsampled image, and the pixel gradient of the binarized image may be obtained by a gradient operator. After the pixel gradient is obtained, edge contour information may be obtained by an edge detection algorithm.

[0058] In the embodiment of the present disclosure, after the contour mask image of the original image is acquired, an idle target cache node is determined from the cache pool, and the contour mask image is cached on the target cache node.

[0059] In the above embodiment, step S102 of “enhancing the original image according to the contour mask image to obtain an enhanced image” may specifically include the following steps S203 and S205 .

[0060] S203, for each original pixel point of the original image, obtaining a contour pixel point in the contour mask image corresponding to the original pixel point.

[0061] For example, for an original pixel point (x, y) of the original image, the contour pixel point corresponding to the original pixel point in the contour mask image is MASK[x / T, y / T].

[0062] S204, performing enhancement filtering on the original pixel points according to the original pixel points and the contour pixel points to obtain enhanced pixel points corresponding to the original pixel points.

[0063] As a possible implementation, Figure 3 As shown, based on the above embodiment, the specific process of performing enhancement filtering on the original pixel points according to the original pixel points and the contour pixel points in the above step S204 to obtain the enhanced pixel points corresponding to the original pixel points includes the following steps:

[0064] S301, determining the region type of the region where the original pixel point is located according to the pixel value of the contour pixel point.

[0065] In the embodiment of the present disclosure, after the pixel value of the contour pixel point is obtained, the region type of the region where the original pixel point is located can be determined according to the pixel value of the contour pixel point.

[0066] For example, if the value of the contour pixel point MASK[x / T,y / T] is 1, the region type of the region where the original pixel point is located is determined to be a contour region; if the value of the contour pixel point MASK[x / T,y / T] is 0, the region type of the region where the original pixel point is located is determined to be a non-contour region.

[0067] S302: Perform enhancement filtering on the original pixel points according to the region type to obtain enhanced pixel points corresponding to the original pixel points.

[0068] In the embodiment of the present disclosure, after the region type is acquired, enhancement filtering may be performed on the original pixel points according to the region type to obtain enhanced pixel points corresponding to the original pixel points.

[0069] Optionally, in response to the region type indicating that the region where the original pixel point is located is a non-contour region, low-intensity enhancement filtering is performed on the original pixel point to obtain an enhanced pixel point corresponding to the original pixel point.

[0070] Optionally, in response to the area type indicating that the area where the original pixel is located is a contour area, the Gaussian filter mean corresponding to the original pixel is determined, and the original pixel is enhanced and filtered based on the original pixel, the contour pixel and the Gaussian filter mean to obtain an enhanced pixel corresponding to the original pixel.

[0071] For example, for the original pixel point (x, y) of the original image, the Gaussian filter mean WINAVG[x, y] corresponding to the original pixel point with a window size of (2r+1)x(2r+1) is calculated. The center point of the filter window is the current pixel, and r is the filter radius constant, which can be set to 1, 2, 3, 4, 5, 6, or 7.

[0072] In the embodiment of the present disclosure, the lowest pixel value and the highest pixel value are determined based on the pixel value of the original pixel point, the candidate pixel value after the original pixel point is enhanced is determined based on the pixel value of the original pixel point, the Gaussian filter mean and the filter strength, and the candidate pixel value is truncated based on the lowest pixel value and the highest pixel value to obtain the enhanced pixel point.

[0073] For example, the enhanced pixel ENHANCE[x,y] can be obtained according to the following formula:

[0074] ENHANCE[x,y]=clip3(SRC[x,y]–a,SRC[x,y]+b,SRC[x,y]+(SRC[x,y]–WINAVG[x,y])*RATIO).

[0075] Among them, ENHANCE[x,y] is the enhanced pixel point, SRC[x,y] is the candidate pixel value, a is the lowest pixel value, b is the highest pixel value, and a and b are constants that can be set to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, etc., WINAVG[x,y] is the Gaussian filter mean, and RATIO is the filter strength.

[0076] In an embodiment of the present disclosure, in response to the candidate pixel value being between the lowest pixel value and the highest pixel value, the candidate pixel value is determined to be the pixel value of the enhanced pixel point to obtain the enhanced pixel point.

[0077] In an embodiment of the present disclosure, in response to the candidate pixel value not being between the lowest pixel value and the highest pixel value, and the enhanced pixel value being less than the lowest pixel value, the lowest pixel value is determined as the pixel value of the enhanced pixel point to obtain the enhanced pixel point.

[0078] In an embodiment of the present disclosure, in response to the candidate pixel value not being between the lowest pixel value and the highest pixel value, and the enhanced pixel value being greater than the highest pixel value, the highest pixel value is determined as the pixel value of the enhanced pixel point to obtain the enhanced pixel point.

[0079] It should be noted that the present disclosure does not limit the process of determining the filtering strength, and it can be determined according to actual conditions.

[0080] Optionally, the filtering strength may be determined based on the configuration information.

[0081] For example, based on the configuration information, the filter strength may be determined to be 0.1, 0.2, ... 2.0 ... 3.0.

[0082] Optionally, a first global parameter of the original image and a first local parameter of the pixel point in the filtering window may be acquired, and the filtering strength may be determined according to the first global parameter and the first local parameter.

[0083] For example, the first global parameter (variance) of the original image and the first local parameter (variance) of the pixels in the filter window may be obtained, and the filter strength may be determined according to the ratio of the first local parameter to the first global parameter.

[0084] Optionally, a second global parameter of the original image and a second local parameter of the original pixel are acquired, and the filtering strength is determined according to the second global parameter and the second local parameter.

[0085] For example, the second global parameter (average value) of the original image and the second local parameter of the original pixel (filtered pixel SRC[x,y]) can be obtained, and the filtering strength can be determined according to the ratio of the second local parameter to the second global parameter.

[0086] S205, obtaining an enhanced image according to the enhanced pixel points corresponding to each original pixel point.

[0087] In the embodiment of the present disclosure, after the enhanced pixel point corresponding to each original pixel point is acquired, an enhanced image ENHANCE may be obtained according to the enhanced pixel point corresponding to each original pixel point.

[0088] In the above embodiment, step S103 of “obtaining a coded image and a reconstructed image of the original image according to the contour mask image and the enhanced image” may specifically include the following steps S206 and S208.

[0089] S206, dividing the enhanced image to obtain a plurality of first-layer coding blocks of the enhanced image.

[0090] Optionally, after the enhanced image is acquired, the enhanced image may be divided according to an encoder standard to obtain a plurality of first-layer coding blocks of the enhanced image.

[0091] For example, for the HEVC encoder and the Versatile Video Coding (VVC), the enhanced image can be divided to obtain several first-layer coding blocks of the enhanced image, namely, coding tree units (CTU); for the open video encoder (AOMedia Video 1, AV1), the enhanced image can be divided to obtain several first-layer coding blocks, namely, super blocks (SB).

[0092] S207, starting from the first layer coding block, perform layer-by-layer division and predict the coding block of the current layer.

[0093] In the disclosed embodiment, the division may be performed layer by layer starting from the first layer coding block, and the coding block of the current layer may be predicted to obtain the prediction information of the coding block of the current layer.

[0094] S208 , for the coding block of the current layer, determine a target division mode of the coding block of the current layer according to the contour mask image, and continue to divide according to the target division mode until the last layer.

[0095] As a possible implementation, Figure 4 As shown, based on the above embodiment, the specific process of determining the target division mode of the coding block of the current layer according to the contour mask image in the above step S208 includes the following steps:

[0096] S401, obtaining a matching coding block corresponding to a coding block of a current layer from a contour mask image.

[0097] It should be noted that if the position of each coding block is (blockx, blockcy) and the size of each coding block is blocksizex*blocksizey, the position of the coding block in the corresponding contour mask image MASK is (blockx / T, blocky / T) and the size is blocksizex / T*blocksizey / T.

[0098] S402: Determine, according to the matching coding block, whether the coding block of the current layer includes a contour area.

[0099] In the disclosed embodiment, it is possible to determine whether the first set pixel value exists in the coding block of the current layer based on the matching coding block, and determine whether the coding block of the current layer includes a contour area based on the determination result.

[0100] S403 : In response to the coding block of the current layer including a contour area, determining a target partitioning mode of the coding block of the current layer from a symmetric partitioning mode and an asymmetric partitioning mode.

[0101] In an embodiment of the present disclosure, it is possible to determine whether there is a first set pixel value in the coding block of the current layer, and in response to the existence of the first set pixel value in the matching coding block, it is determined that the coding block of the current layer includes a contour area, wherein the first set pixel value is 1.

[0102] For example, if the first set pixel value 1 exists in the coding block of the current layer, it is determined that the coding block of the current layer includes a contour area.

[0103] In an embodiment of the present disclosure, in response to the coding block of the current layer including a contour area, the target division mode of the coding block of the current layer is determined from the symmetric division mode and the asymmetric division mode, that is, the target division mode of the coding block of the current layer can be a symmetric division mode or an asymmetric division mode.

[0104] For example, Figure 5 As shown, for the HEVC encoder, if the target division mode of the coding block of the current layer is a symmetric division mode, there can be four types of symmetric division modes, including 2N×2N, that is, the prediction unit (PredictionUnit, referred to as PU) is the same as the coding unit, 2N×N, that is, the PU is divided into two equal parts in the horizontal direction, and N×N, that is, the PU is divided into four equal parts in the horizontal and vertical directions.

[0105] For example, continue as Figure 5 As shown, for the HEVC encoder, if the target partitioning mode of the coding block of the current layer is an asymmetric partitioning mode, there are four types of asymmetric partitioning modes, including 2N×nU, that is, the PU is divided into two parts in the vertical direction, the upper part is 2N×(N / 4), and the lower part is 2N×(3N / 4); 2N×nD, that is, the PU is divided into two parts in the vertical direction, the upper part is 2N×(3N / 4), and the lower part is 2N×(N / 4); nL×2N, that is, the PU is divided into two parts in the horizontal direction, the left part is (N / 4)×2N, and the right part is (3N / 4)×2N; nR×2N, that is, the PU is divided into two parts in the horizontal direction, the left part is (3N / 4)×2N, and the right part is (N / 4)×2N.

[0106] S404: In response to the fact that the coding block of the current layer does not include a contour area, determine a target partitioning mode of the coding block of the current layer from symmetric partitioning modes.

[0107] In an embodiment of the present disclosure, it is possible to determine whether there is a first set pixel value in the coding block of the current layer, and in response to the absence of the first set pixel value in the matching coding block, it is determined that the coding block of the current layer does not include a contour area, wherein the first set pixel value is 1.

[0108] For example, if the first set pixel value 1 does not exist in the coding block of the current layer, that is, the pixel values ​​in the coding block of the current layer are all 0, it is determined that the coding block of the current layer does not include a contour area.

[0109] In an embodiment of the present disclosure, in response to the fact that the coding block of the current layer does not include a contour area, the target division mode of the coding block of the current layer is determined from the symmetric division mode, that is, the target division mode of the coding block of the current layer is the symmetric division mode.

[0110] S209, determining an optimal division mode according to the prediction information of each layer of coding blocks, and performing subsequent encoding processes on the coding blocks corresponding to the optimal division mode to obtain a coded bitstream and a reconstructed image.

[0111] For example, for the A-th layer coding block, it can be divided according to the 2N×2N mode in the symmetric mode to obtain prediction information A1, and for the B-th layer coding block, it can be divided according to the 2N×N mode in the symmetric mode to obtain prediction information B1. Based on the prediction information A1 and the prediction information B1, if the prediction information B1 is better than the prediction information A1, the 2N×N mode is determined as the optimal division mode.

[0112] In the embodiment of the present disclosure, after the optimal division mode is obtained, a subsequent encoding process may be performed on the encoding block corresponding to the optimal division mode to obtain an encoding code stream and a reconstructed image.

[0113] For example, for the HEVC encoder, the original pixel block and the predicted pixel block can be subtracted to obtain a residual block, the residual block can be transformed and quantized, and then entropy encoded to obtain a coded bitstream, the quantized transformed block can be inversely transformed and inversely quantized to obtain a decoded residual block, the decoded residual block and the predicted block can be added, and deblocking DEBLOCK and sample adaptive offset (SAO) filtering can be performed to obtain a reconstructed image.

[0114] In the embodiment of the present disclosure, in response to the completion of encoding of the original image, the contour mask image is deleted from the target cache node to release the target cache node.

[0115] In summary, the image coding method proposed in the present disclosure downsamples the brightness of the original image to obtain a downsampled image, obtains a contour mask image according to the downsampled image, obtains the contour pixel corresponding to the original pixel in the contour mask image for each original pixel point of the original image, performs enhancement filtering on the original pixel point according to the original pixel point and the contour pixel point to obtain the enhanced pixel point corresponding to the original pixel point, obtains an enhanced image according to the enhanced pixel point corresponding to each original pixel point, divides the enhanced image to obtain several first-layer coding blocks of the enhanced image, divides the image layer by layer starting from the first-layer coding block, predicts the coding block of the current layer, and predicts the coding block of the current layer according to the contour mask image. For example, a target division mode of the coding block of the current layer is determined, and the division is continued according to the target division mode until the last layer. According to the prediction information of the coding block of each layer, the optimal division mode is determined, and the subsequent encoding process is performed on the coding block corresponding to the optimal division mode to obtain a coded code stream and a reconstructed image. Therefore, the present disclosure proposes an image coding method combined with contour detection, which can determine the target division mode of the coding block of the current layer according to the contour mask image, and determine the optimal division mode according to the prediction information of the coding block of each layer, and perform the subsequent encoding process on the coding block corresponding to the optimal division mode, thereby improving the image quality and compression rate, reducing the image encoding time, and improving the image encoding efficiency, achieving a double-optimal effect.

[0116] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0117] According to an embodiment of the present disclosure, the present disclosure also provides an image encoding device for implementing the above-mentioned image encoding method.

[0118] Figure 6 is a block diagram of an image encoding apparatus according to an embodiment of the present disclosure.

[0119] like Figure 6 As shown, the image encoding device 600 includes: a first acquisition module 601, an enhancement module 602 and a second acquisition module 603.

[0120] A first acquisition module 601 is used to acquire a contour mask image of an original image;

[0121] An enhancement module 602 is used to enhance the original image according to the contour mask image to obtain an enhanced image;

[0122] The second acquisition module 603 is used to acquire the coded code stream of the original image and the reconstructed image according to the contour mask image and the enhanced image.

[0123] In one embodiment of the present disclosure, the enhancement module 602 is further used to: for each original pixel point of the original image, obtain the contour pixel point corresponding to the original pixel point in the contour mask image; perform enhancement filtering on the original pixel point according to the original pixel point and the contour pixel point to obtain the enhanced pixel point corresponding to the original pixel point; and obtain the enhanced image according to the enhanced pixel point corresponding to each of the original pixel points.

[0124] In one embodiment of the present disclosure, the enhancement module 602 is also used to: determine the region type of the region where the original pixel point is located based on the pixel value of the contour pixel point; and perform enhancement filtering on the original pixel point based on the region type to obtain an enhanced pixel point corresponding to the original pixel point.

[0125] In one embodiment of the present disclosure, the enhancement module 602 determines the minimum pixel value and the maximum pixel value according to the pixel value of the original pixel point; determines the candidate pixel value after the original pixel point is enhanced according to the pixel value of the original pixel point, the Gaussian filter mean and the filter strength; and truncates the candidate pixel value according to the minimum pixel value and the maximum pixel value to obtain the enhanced pixel point.

[0126] In one embodiment of the present disclosure, the enhancement module 602, in response to the candidate pixel value being between the minimum pixel value and the maximum pixel value, determines that the candidate pixel value is the pixel value of the enhancement pixel point to obtain the enhancement pixel point; in response to the candidate pixel value not being between the minimum pixel value and the maximum pixel value, and the enhancement pixel value is less than the minimum pixel value, determines that the minimum pixel value is the pixel value of the enhancement pixel point to obtain the enhancement pixel point; in response to the candidate pixel value not being between the minimum pixel value and the maximum pixel value, and the enhancement pixel value is greater than the maximum pixel value, determines that the maximum pixel value is the pixel value of the enhancement pixel point to obtain the enhancement pixel point.

[0127] In one embodiment of the present disclosure, the process of determining the filtering strength includes: determining the filtering strength based on configuration information; or, obtaining a first global parameter of the original image and a first local parameter of a pixel point in a filtering window, and determining the filtering strength based on the first global parameter and the first local parameter; or, obtaining a second global parameter of the original image and a second local parameter of the original pixel point, and determining the filtering strength based on the second global parameter and the second local parameter.

[0128] In one embodiment of the present disclosure, the enhancement module 602 is further used to: in response to the area type indicating that the area where the original pixel point is located is a non-contour area, perform low-intensity enhancement filtering on the original pixel point to obtain an enhanced pixel point corresponding to the original pixel point.

[0129] In one embodiment of the present disclosure, the second acquisition module 603 is also used to: divide the enhanced image to obtain several first-layer coding blocks of the enhanced image; start dividing layer by layer from the first-layer coding blocks, and predict the coding blocks of the current layer; for the coding blocks of the current layer, determine the target division mode of the coding blocks of the current layer according to the contour mask image, and continue to divide according to the target division mode until the last layer; determine the optimal division mode according to the prediction information of the coding blocks of each layer, and execute the subsequent encoding process for the coding blocks corresponding to the optimal division mode to obtain the encoded code stream and the reconstructed image.

[0130] In one embodiment of the present disclosure, the second acquisition module 603 is also used to: acquire a matching coding block corresponding to the coding block of the current layer from the contour mask image; determine whether the coding block of the current layer includes a contour area based on the matching coding block; in response to the coding block of the current layer including a contour area, determine a target division mode of the coding block of the current layer from a symmetric division mode and an asymmetric division mode; in response to the coding block of the current layer not including a contour area, determine the target division mode of the coding block of the current layer from a symmetric division mode.

[0131] In one embodiment of the present disclosure, the second acquisition module 603 is also used to: in response to the presence of a first set pixel value in the matching coding block, determine that the coding block of the current layer includes a contour area; in response to the absence of the first set pixel value in the matching coding block, determine that the coding block of the current layer does not include a contour area.

[0132] In one embodiment of the present disclosure, the first acquisition module 601 is further used to: perform brightness down-sampling on the original image to obtain a down-sampled image; and obtain the contour mask image according to the down-sampled image.

[0133] In one embodiment of the present disclosure, the first acquisition module 601 is further used to: acquire edge contour information of the down-sampled image, and acquire the contour mask image according to the edge contour information.

[0134] In one embodiment of the present disclosure, the first acquisition module 601 is further used to: acquire a binary image of the downsampled image, and extract a connected area from the binary image; and perform edge contour detection on the connected area to acquire the edge contour information.

[0135] In one embodiment of the present disclosure, the first acquisition module 601 is further used to: acquire a binarized image of the downsampled image, and acquire a pixel gradient of the binarized image; and acquire the edge contour information according to the pixel gradient.

[0136] In one embodiment of the present disclosure, the apparatus 600 is further configured to: determine an idle target cache node from a cache pool, and cache the contour mask image on the target cache node.

[0137] In one embodiment of the present disclosure, the apparatus 600 is further configured to: in response to completion of encoding of the original image, delete the contour mask image from the target cache node to release the target cache node.

[0138] The image encoding device proposed in the present disclosure obtains a contour mask image of the original image, enhances the original image according to the contour mask image, obtains an enhanced image, and obtains a coded code stream and a reconstructed image of the original image according to the contour mask image and the enhanced image. Therefore, the present disclosure improves the image quality and compression rate, reduces the image encoding time, and improves the image encoding efficiency by obtaining a contour mask image of the original image, and obtaining a coded code stream and a reconstructed image of the original image according to the contour mask image and the enhanced image.

[0139] According to an embodiment of the present disclosure, the present disclosure also proposes an electronic device, a readable storage medium, and a computer program product.

[0140] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0141] like Figure 7As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0142] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 706, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0143] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as image encoding methods. For example, in some embodiments, the image encoding method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the image encoding method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the image encoding method in any other appropriate manner (e.g., by means of firmware).

[0144] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0145] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be presented to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0146] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0147] To propose interactions with a user account, the systems and techniques described herein may be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user account; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user account can propose input to the computer. Other types of devices may also be used to propose interactions with the user account; for example, feedback proposed to the user account may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user account may be received in any form (including acoustic input, voice input, or tactile input).

[0148] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user account computer with a graphical user account interface or a web browser through which a user account can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0149] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0150] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the steps of the image encoding method described in the above embodiment of the present disclosure are implemented.

[0151] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0152] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for encoding an image, wherein: The method comprises: Get the contour mask image of the original image; enhancing the original image according to the contour mask image to obtain an enhanced image; According to the contour mask image and the enhanced image, an encoded code stream and a reconstructed image of the original image are obtained.

2. The method according to claim 1, wherein: The step of enhancing the original image according to the contour mask image to obtain an enhanced image comprises: For each original pixel point of the original image, obtaining a contour pixel point corresponding to the original pixel point in the contour mask image; According to the original pixel point and the contour pixel point, the original pixel point is enhanced and filtered to obtain an enhanced pixel point corresponding to the original pixel point; The enhanced image is obtained according to the enhanced pixel points corresponding to each of the original pixel points.

3. The method according to claim 2, wherein: The step of performing enhancement filtering on the original pixel points according to the original pixel points and the contour pixel points to obtain enhanced pixel points corresponding to the original pixel points includes: Determining the region type of the region where the original pixel point is located according to the pixel value of the contour pixel point; According to the region type, the original pixel point is enhanced and filtered to obtain an enhanced pixel point corresponding to the original pixel point.

4. The method according to claim 3, wherein: The step of performing enhancement filtering on the original pixel points according to the region type to obtain enhanced pixel points corresponding to the original pixel points includes: In response to the region type indicating that the region where the original pixel point is located is a contour region, determining a Gaussian filtering mean corresponding to the original pixel point; According to the original pixel point, the contour pixel point and the Gaussian filter mean, the original pixel point is enhanced and filtered to obtain an enhanced pixel point corresponding to the original pixel point.

5. The method according to claim 4, wherein: The step of performing enhancement filtering on the original pixel point according to the original pixel point, the contour pixel point and the Gaussian filter mean to obtain an enhanced pixel point corresponding to the original pixel point includes: Determine a minimum pixel value and a maximum pixel value according to the pixel values ​​of the original pixel points; Determine a candidate pixel value after the original pixel is enhanced according to the pixel value of the original pixel, the Gaussian filter mean and the filter strength; According to the minimum pixel value and the maximum pixel value, the candidate pixel value is truncated to obtain the enhanced pixel point.

6. The method according to claim 5, wherein: The step of truncating the candidate pixel value according to the lowest pixel value and the highest pixel value to obtain the enhanced pixel point includes: In response to the candidate pixel value being between the lowest pixel value and the highest pixel value, determining the candidate pixel value as the pixel value of the enhanced pixel point to obtain the enhanced pixel point; In response to the candidate pixel value not being between the minimum pixel value and the maximum pixel value, and the enhanced pixel value being less than the minimum pixel value, determining the minimum pixel value as the pixel value of the enhanced pixel point to obtain the enhanced pixel point; In response to the candidate pixel value not being between the lowest pixel value and the highest pixel value, and the enhanced pixel value being greater than the highest pixel value, the highest pixel value is determined as the pixel value of the enhanced pixel point to obtain the enhanced pixel point.

7. The method according to claim 5, characterized in that The process of determining the filtering strength includes: Determine the filtering strength based on the configuration information; or, Acquire a first global parameter of the original image and a first local parameter of a pixel point in a filtering window, and determine the filtering strength according to the first global parameter and the first local parameter; or, A second global parameter of the original image and a second local parameter of the original pixel are acquired, and the filtering strength is determined according to the second global parameter and the second local parameter.

8. The method according to claim 3, wherein: The step of performing enhancement filtering on the original pixel points according to the region type to obtain enhanced pixel points corresponding to the original pixel points includes: In response to the region type indicating that the region where the original pixel point is located is a non-contour region, a low-intensity enhancement filter is performed on the original pixel point to obtain an enhanced pixel point corresponding to the original pixel point.

9. The method according to any one of claims 1 to 8, wherein: The step of obtaining the coded image and the reconstructed image of the original image according to the contour mask image and the enhanced image comprises: Dividing the enhanced image to obtain a plurality of first-layer coding blocks of the enhanced image; Starting from the first-layer coding block, the coding blocks are divided layer by layer, and the coding blocks of the current layer are predicted; For a coding block of a current layer, determining a target division mode of the coding block of the current layer according to the contour mask image, and continuing to divide the coding block according to the target division mode until the last layer; An optimal division mode is determined according to prediction information of each layer of coding blocks, and a subsequent coding process is performed on the coding blocks corresponding to the optimal division mode to obtain the coding code stream and the reconstructed image.

10. The method according to claim 9, wherein: The step of determining a target partitioning mode of a coding block of a current layer according to the contour mask image comprises: Acquire, from the contour mask image, a matching coding block corresponding to the coding block of the current layer; According to the matching coding block, determining whether the coding block of the current layer includes a contour area; In response to the coding block of the current layer including a contour area, determining a target partition mode of the coding block of the current layer from a symmetric partition mode and an asymmetric partition mode; In response to the coding block of the current layer not including a contour area, a target partitioning mode of the coding block of the current layer is determined from symmetric partitioning modes.

11. The method according to claim 10, wherein: The step of judging, according to the matching coding block, whether the coding block of the current layer includes a contour area includes: In response to the presence of a first set pixel value in the matching coding block, determining that the coding block of the current layer includes a contour area; In response to the first set pixel value not existing in the matching coding block, it is determined that the coding block of the current layer does not include a contour area.

12. The method according to claim 1, wherein: The step of obtaining a contour mask image of the original image comprises: Downsampling the brightness of the original image to obtain a downsampled image; The contour mask image is obtained according to the down-sampled image.

13. The method according to claim 12, wherein: The step of acquiring the contour mask image according to the down-sampled image comprises: Obtain edge contour information of the down-sampled image, and obtain the contour mask image according to the edge contour information.

14. The method according to claim 13, wherein: The obtaining edge contour information of the down-sampled image includes: Obtaining a binary image of the downsampled image, and extracting connected regions from the binary image; Perform edge contour detection on the connected area to obtain the edge contour information.

15. The method according to claim 13, wherein: The obtaining edge contour information of the down-sampled image includes: Obtaining a binarized image of the downsampled image, and obtaining a pixel gradient of the binarized image; The edge contour information is obtained according to the pixel gradient.

16. The method according to any one of claims 12 to 15, wherein: After obtaining the contour mask image of the original image, the method further includes: An idle target cache node is determined from the cache pool, and the contour mask image is cached on the target cache node.

17. The method according to claim 16, wherein: The method further comprises: In response to the original image encoding being completed, the contour mask image is deleted from the target cache node to release the target cache node.

18. An image encoding device, wherein: The device comprises: A first acquisition module is used to acquire a contour mask image of an original image; An enhancement module, used for enhancing the original image according to the contour mask image to obtain an enhanced image; The second acquisition module is used to acquire the coded code stream and the reconstructed image of the original image according to the contour mask image and the enhanced image.

19. An electronic device, characterized in that: including a processor and a memory; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the method as claimed in any one of claims 1 to 17.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 17 is implemented.

21. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 17.