An image encoding and decoding method and related products

By performing edge detection and fitting point processing on the image, compensating values ​​are generated and smoothed, the problem of high-frequency edge information loss during image encoding in the prior art is solved, and the image quality is improved and the code rate is reduced.

CN114697659BActive Publication Date: 2025-05-27CAMBRICON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011643550.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-30
Publication Date
2025-05-27
Estimated Expiration
2040-12-30

AI Technical Summary

Technical Problem

When the existing encoding technology encodes an image containing an edge, it is easy to cause the loss of high-frequency information carried by the edge, thereby reducing the image quality and increasing the code rate.

Method used

By performing edge detection on the image to be encoded, the fit point coordinates and compensation values ​​of the edge are obtained, and pixel points on the connecting curve are smoothed to generate a first image. Then, the fitted point coordinates, compensation values, and the first image are encoded to generate the encoded data.

Benefits of technology

It effectively reduces the loss of high-frequency information at the edge, improves image quality, and reduces the code rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114697659B_ABST
    Figure CN114697659B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses an image encoding and decoding method and related products. The method performs edge detection on the image to be encoded, obtains fitting points from the above-mentioned edges, and the proximity between the fitting curve generated by the fitting points and the connected curve determined by the edges is less than the target threshold. Then, according to the obtained compensation value, the above-mentioned connected curve and the obtained target pixel points are smoothed to obtain a first image. The coordinates of at least two fitting points, the compensation value, and the first image are respectively encoded and decoded, and then a fitting curve is generated according to the decoded fitting point coordinates, and the fitting curve and the obtained target pixel points in the first image are compensated according to the compensation value to obtain a compensated image. After separating the edges, the method encodes and decodes the edge information and the separated image respectively, which can reduce the loss of high-frequency information carried by the edges.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information processing technologies, and in particular, to an image encoding and decoding method and related products. Background Art

[0002] The frequency of an image is an index characterizing the degree of drastic change in grayscale in the image. Since an edge is a set of pixels with a drastic change in pixel grayscale values in the image, the edge contains more high-frequency information. At the same time, the image edge exists between the target, the background, and the region, is a region that is relatively sensitive and visible to the human eye, and is an important feature of the image.

[0003] Currently, existing encoding technologies directly encode an image containing edges, which will cause the loss of high-frequency information carried by the edges. Summary of the Invention

[0004] Embodiments of this application provide an image encoding and decoding method and related products, which can optimize the encoding and decoding of an image containing edges, thereby reducing the loss of high-frequency information carried by the edges, improving the image quality, and reducing the bit rate.

[0005] In a first aspect, embodiments of this application provide an image encoding method, which includes:

[0006] Obtain an image to be encoded;

[0007] Perform edge detection on the image to be encoded to obtain at least one edge, where the edge is composed of M pixel points, and M is a positive integer greater than 1;

[0008] Obtain at least two fitting points from the M pixel points, and the proximity degree between the target fitting curve generated according to the at least two fitting points and the curve model and the connected curve determined by the edge is less than a target threshold. The connected curve is composed of N pixel points among the M pixel points, and the positions of any two adjacent pixel points among the N pixel points are adjacent. N is a positive integer less than M and greater than 1;

[0009] Determine the pixel points adjacent to the pixel points on the connected curve in the image to be encoded as target pixel points;

[0010] Obtain a compensation value according to the pixel values of all the pixel points on the connected curve and the target pixel points in the image to be encoded;

[0011] Perform smoothing processing on all the pixel points on the connected curve and the target pixel points in the image to be encoded according to the compensation value to obtain a first image;

[0012] Encode the coordinates of the at least two fitting points, the compensation value, and the first image respectively to obtain the encoded coordinates of the fitting points, the encoded compensation value, and the encoded first image.

[0013] In a possible implementation, the performing edge detection on the image to be encoded to obtain at least one edge includes:

[0014] Calculate the gray value gradient of each pixel point in the image to be encoded;

[0015] Determine the pixel points with gray value gradients greater than the target gradient value as edge pixel points, and the edge pixel points with adjacent positions are on the same edge.

[0016] In a possible implementation, the obtaining at least two fitting points from the M pixel points includes:

[0017] Calculate the curvature of the connected curve at each of the M pixel points;

[0018] Determine the pixel points with curvatures exceeding a preset amount among the M pixel points as fixed fitting points;

[0019] Generate a first fitting curve according to the fixed fitting points and the curve model;

[0020] When the degree of approximation between the first fitting curve and the connected curve is not less than the target threshold, select at least one pending fitting point from the M pixel points;

[0021] Generate a second fitting curve according to the fixed fitting points, the selected pending fitting points, and the curve model;

[0022] When the degree of approximation between the second fitting curve and the connected curve is not less than the target threshold, repeatedly execute the step of selecting at least one pending fitting point from the M pixel points and the step of generating a second fitting curve according to the fixed fitting points and the selected pending fitting points;

[0023] When the degree of approximation between the second fitting curve and the connected curve is less than the target threshold, determine the at least two fitting points as the fixed fitting points and the selected pending fitting points.

[0024] In a possible implementation, the number of the target pixel points is N, and obtaining a compensation value according to the pixel values of all pixel points on the connected curve and the target pixel points in the image to be encoded includes:

[0025] Determine the first pixel value as the average value of the pixel values of all pixel points on the connected curve in the image to be encoded;

[0026] Determine that the second pixel value is the average value of the pixel values of the target pixel point in the image to be encoded;

[0027] Determine that the compensation value is W, where W is the difference between the first pixel value and the second pixel value.

[0028] In a possible implementation, the smoothing the pixel points on the connected curve and the target pixel point in the image to be encoded according to the compensation value to obtain a first image includes:

[0029] Determine that the pixel value of the first pixel point on the connected curve in the first image is the difference between the pixel value of the first pixel point in the image to be encoded and the compensation value, where the first pixel point is any pixel point on the connected curve;

[0030] Determine that the pixel value of the second pixel point in the target pixel point in the first image is the sum of the pixel value of the second pixel point in the image to be encoded and the compensation value, where the second pixel point is any pixel point in the target pixel point.

[0031] In a second aspect, an embodiment of the present application provides an image decoding method, and the method includes:

[0032] Decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image respectively to obtain the fitting point coordinates, the compensation value, and the first image;

[0033] Generate a fitting curve according to the fitting point coordinates and the curve model;

[0034] Determine the pixel points adjacent to the pixel points located on the fitting curve in the first image as target pixel points;

[0035] Compensate all the pixel points located on the fitting curve and the target pixel points in the first image according to the compensation value to obtain a compensated image.

[0036] In a possible implementation, the compensating all the pixel points located on the fitting curve and the target pixel points in the first image according to the compensation value to obtain a compensated image includes:

[0037] Add the compensation value to the pixel values of all the pixel points on the fitting curve in the first image;

[0038] Subtract the compensation value from the pixel values of the target pixel points in the first image to obtain the compensated image.

[0039] Thirdly, an embodiment of the present application provides an encoder, which includes units for performing the method in the first aspect above. Specifically, the apparatus may include:

[0040] A first acquisition unit, configured to acquire an image to be encoded;

[0041] A detection unit, configured to perform edge detection on the image to be encoded to obtain at least one edge, where the edge is composed of M pixel points, and M is a positive integer greater than 1;

[0042] A second acquisition unit, configured to acquire at least two fitting points from the M pixel points, and a proximity degree between a target fitting curve generated according to the at least two fitting points and a curve model and a connected curve determined by the edge is less than a target threshold, where the connected curve is composed of N pixel points among the M pixel points, any two adjacent pixel points among the N pixel points are adjacent in position, and N is a positive integer less than M and greater than 1;

[0043] A determination unit, configured to determine pixel points adjacent to the pixel points on the connected curve in the image to be encoded as target pixel points;

[0044] A calculation unit, configured to obtain a compensation value according to pixel values of all pixel points on the connected curve and the target pixel points in the image to be encoded;

[0045] A smoothing unit, configured to perform smoothing processing on all pixel points on the connected curve and the target pixel points in the image to be encoded according to the compensation value to obtain a first image;

[0046] An encoding unit, configured to encode coordinates of the at least two fitting points, the compensation value, and the first image respectively to obtain encoded fitting point coordinates, an encoded compensation value, and an encoded first image.

[0047] Fourthly, an embodiment of the present application provides a decoder, which includes units for performing the method in the second aspect above. Specifically, the apparatus may include:

[0048] A decoding unit, configured to decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image respectively to obtain the fitting point coordinates, the compensation value, and the first image;

[0049] A fitting unit, configured to generate a fitting curve according to the fitting points and a curve model;

[0050] A determination unit, configured to determine pixel points adjacent to the pixel points located on the fitting curve in the first image as target pixel points;

[0051] A compensation unit, configured to compensate all pixel points located on the fitting curve and the target pixel point in the first image according to the compensation value, so as to obtain a compensated image.

[0052] In a fifth aspect, an embodiment of the present application provides a computer device, including a processor and a memory, where the processor and the memory are connected to each other. The memory is used to store a computer program that supports an encoder or a decoder to execute the above method. The computer program includes program instructions, and the processor is configured to call the program instructions to execute the methods of the first aspect and the second aspect above.

[0053] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor is caused to execute the methods of the first aspect and the second aspect above.

[0054] In a seventh aspect, an embodiment of the present application provides a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the processor is caused to execute the methods of the first aspect and the second aspect above.

[0055] By implementing the embodiments of the present application, through edge separation of the image to be encoded, obtaining the fitting point coordinates of the edge, the compensation value, and the separated first image, encoding and decoding the fitting point coordinates of the edge, the compensation value, and the separated first image respectively, and compensating the first image according to the fitting point coordinates of the edge and the compensation value, a compensated image is obtained. Executing the embodiments of the present application can optimize the encoding and decoding of an image containing an edge, thereby reducing the loss of high-frequency information carried by the edge, improving the image quality, and reducing the bit rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments.

[0057] Figure 1 is a schematic flowchart of an image encoding method provided by an embodiment of the present application;

[0058] Figure 2 is a schematic flowchart of a method for obtaining fitting points provided by an embodiment of the present application;

[0059] Figure 3 is a schematic diagram of calculating the curvature of a pixel point provided by the present application;

[0060] Figure 4 is a schematic diagram of determining a target pixel point provided by an embodiment of the present application;

[0061] Figure 5 It is a schematic diagram provided by an embodiment of the present application for indicating the position of a target pixel point;

[0062] Figure 6 It is a schematic flowchart of an image decoding method provided by an embodiment of the present application;

[0063] Figure 7A It is a schematic structural diagram of an encoder 30 provided by an embodiment of the present application;

[0064] Figure 7B It is a schematic structural diagram of a decoder 40 provided by an embodiment of the present application;

[0065] Figure 8A It is a schematic structural diagram of an encoder provided by an embodiment of the present application;

[0066] Figure 8B It is a schematic structural diagram of a decoder provided by an embodiment of the present application. Detailed implementation manners

[0067] Next, the technical solutions in the embodiments of the present application will be described in conjunction with the accompanying drawings in the embodiments of the present application.

[0068] It should be understood that the terms "first", "second", "third", etc. in the claims, the description and the drawings of the present disclosure are used to distinguish different objects, rather than to describe a specific order. The terms "including" and "comprising" used in the description and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their combinations.

[0069] It should also be understood that the terms used in the description of the present disclosure herein are only for the purpose of describing specific embodiments, and are not intended to limit the present disclosure. As used in the description and claims of the present disclosure, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include the plural forms. It should be further understood that the term "and / or" used in the description and claims of the present disclosure refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0070] As used in this specification and the claims, the term "if" may be construed, depending on the context, as "when", "once", "in response to determining", or "in response to detecting". Similarly, the phrases "if determined" or "if [the described condition or event] is detected" may be construed, depending on the context, to mean "once determined", "in response to determining", "once [the described condition or event] is detected", or "in response to detecting [the described condition or event]".

[0071] The following combines Figure 1 The flowchart of an image encoding method provided by an embodiment of the present application shown below specifically describes the image encoding method of the embodiment of the present application. The method may include but is not limited to the following steps:

[0072] S101. Obtain an image to be encoded.

[0073] Specifically, the encoder may obtain a frame of image from the video as the image to be encoded. For example, the server may use all the images in the video as the images to be encoded and execute this image encoding method for each frame of the video.

[0074] S102. Perform edge detection on the image to be encoded to obtain at least one edge, where the edge is composed of M pixel points, and M is a positive integer greater than 1.

[0075] Specifically, the encoder may detect the image to be encoded according to an edge detection algorithm to obtain a binary image, where the binary image includes at least one edge.

[0076] Specifically, the encoder may calculate the gray value gradient of each pixel point in the image to be encoded, determine the pixel points with the gray value gradient greater than the target gradient value as edge pixel points, and the edge pixel points with adjacent positions are located on the same edge. Then, the encoder sets the gray value of the determined edge pixel points to the first gray value and sets the other pixel points except the edge to the second gray value. The first gray value and the second gray value are unequal gray values, and an image with only two gray levels, that is, a binary image, is obtained.

[0077] Among them, one or more edges may be included in the same image to be encoded. If an image to be encoded includes multiple edges, the number of pixel points included in different edges may be different, that is, the value of M for each edge may be different.

[0078] In one implementation, the server may detect the image to be encoded according to the Sobel edge detection algorithm. The specific detection steps are as follows:

[0079] Specifically, the two convolution kernels of the Sobel operator are as follows:

[0080]

[0081] Among them, Sobel x is the convolution kernel in the horizontal direction, and Sobel y is the convolution kernel in the vertical direction.

[0082] The server can perform convolution operations on the pixel values of each pixel point of the image to be encoded with the two convolution kernels respectively, to obtain the horizontal gray value and the vertical gray value of each pixel point in the image to be encoded.

[0083] Taking the target pixel point as an example, if the horizontal gray value of the target pixel point is represented by G x and the vertical gray value of the target pixel point is represented by G y . The formula for calculating the gray value gradient G of the target pixel point is as follows:

[0084]

[0085] If the gray value gradient G of the target pixel point is greater than the target threshold, then determine that the target pixel point is an edge point.

[0086] In some embodiments, it is also possible to determine that the target pixel point is an edge point when the gray value gradient G of the target pixel point is greater than the target threshold and the gray value of the target pixel point is greater than the gray values of the pixel points adjacent to the position of the target pixel point.

[0087] Among them, this edge detection algorithm can also be the Laplace edge detection algorithm, and can also be other detection algorithms. This is not limited here.

[0088] Preferably, the server can also perform opening operation and closing operation on the image to be encoded after edge detection to obtain the above binary image. Among them, the opening operation is to perform erosion operation on the image first and then dilation operation; the closing operation is to perform dilation operation on the image first and then erosion operation. It should be understood that the opening operation and the closing operation are optimizations of the above binary image. Among them, the opening operation can remove isolated pixel points while the position and shape of the overall edge remain unchanged, and the closing operation can fill the blank pixel points in the middle of the edge while the position and shape of the overall edge remain unchanged.

[0089] It should be noted that in some embodiments, when the encoder detects that there is no edge in the image to be encoded, the following steps are not executed, and other encoding processes can be performed on the image to be encoded. The embodiments of the present application do not elaborate on this.

[0090] S103. Obtain at least two fitting points from the M pixel points, and the proximity degree between the target fitting curve generated according to the at least two fitting points and the curve model and the connected curve determined by the edge is less than the target threshold.

[0091] Taking the first edge in the image to be encoded as an example, the first edge is any edge in the image to be encoded, and the first edge is composed of M pixel points. Specifically, the encoder can obtain at least two fitting points from the M pixel points of the first edge. The proximity between the target fitting curve generated by the at least two fitting points and the curve model and the connected curve determined by the first edge is less than the target threshold. The connected curve is composed of N pixel points among the M pixel points, and the positions of any two adjacent pixel points among the N pixel points are adjacent. N is a positive integer less than M and greater than 1.

[0092] Please refer to Figure 2 , Figure 2 which is a schematic flow chart of obtaining fitting points provided by an embodiment of the present application. Taking the first edge as an example, the method may include the following partial or all steps:

[0093] S1031. Determine the connected curve of the first edge according to the first edge. The connected curve includes M pixel points.

[0094] Specifically, the encoder can select N pixel points from the M pixel points of the first edge. The set of the N pixel points is the connected curve corresponding to the first edge, and the N pixel points should satisfy that the positions of any two adjacent pixel points are adjacent. That is, the front and rear two pixel points forming the connected curve are connected in position. Specifically, it is manifested that among the eight pixel points adjacent to any pixel point on the connected curve except the pixel points at both ends, there are two points on the connected curve.

[0095] In one implementation, among the eight pixel points adjacent to any pixel value point except the pixel points at both ends of the connected curve, there are exactly two pixel points that are on the connected curve. It should be noted that the method for determining the connected curve of the first edge is not limited herein.

[0096] S1032. Determine the fixed fitting points from the M pixel points according to the curvatures of the connected curve at the M pixel points respectively.

[0097] Specifically, the encoder can calculate the curvatures of the connected curve at the M pixel points respectively, and then determine the pixel points with curvatures exceeding the preset amount among the M pixel points as the fixed fitting points.

[0098] Please refer to Figure 3 , Figure 3 which is a schematic diagram of calculating the curvature of a pixel point provided by the present application. As Figure 3 shown, the first pixel point is a pixel point on the connected curve. The encoder determines a target rectangular area centered on the first pixel point. The target rectangular area is divided into a first area and a second area by the first connected curve. The server takes the absolute value of the difference between the first area and the second area as the curvature of the first pixel point. As Figure 3As shown, the target rectangle is a 5x5 area. The area of the first region is 13 area units, and the area of the second region is 7 area units. Then the curvature of the first pixel point is 5 area units.

[0099] It should be noted that the fixed fitting points also include the two endpoints of the connected curve.

[0100] S1033. Obtain at least two fitting points according to the fixed fitting points. The proximity between the fitting curve generated based on the at least two fitting points and the curve model and the connected curve is less than the target threshold.

[0101] Specifically, the server can generate a first fitting curve according to the fixed fitting points and the curve model; when calculating that the proximity between the first fitting curve and the connected curve is not less than the target threshold, select at least one pending fitting point from the M pixel points; generate a second fitting curve according to the fixed fitting points, the selected pending fitting point and the curve model; when the proximity between the second fitting curve and the connected curve is not less than the target threshold, repeatedly execute the steps of selecting at least one pending fitting point from the M pixel points and generating the second fitting curve according to the fixed fitting points and the selected pending fitting point; when the proximity between the second fitting curve and the connected curve is less than the target threshold, determine the at least two fitting points as the fixed fitting points and the selected pending fitting point.

[0102] In some embodiments, the points on the fitting curve and the connected curve correspond one by one, and the proximity is the sum of the Euclidean distances of the points corresponding one by one on the fitting curve and the connected curve. Among them, the curve model can be a cubic spline interpolation function, or other functions, which are not limited here.

[0103] It should be noted that when the image to be encoded includes multiple edges, the encoder can determine the connected curve corresponding to each edge according to each edge, and obtain at least two fitting points corresponding to each edge from each edge. The specific process of obtaining the fitting points of each edge can refer to the relevant content of obtaining the fitting points of the first edge above.

[0104] S104. Determine the pixel points adjacent to the pixel points on the connected curve in the image to be encoded as the target pixel points.

[0105] Specifically, taking the first edge as an example above, the encoder can select the pixel points adjacent to the position on the connected curve of the first edge as the target pixel points of the first edge according to the linear model agreed with the decoder, or can encode the indication information indicating the position of the target pixel points of the first edge and send it to the decoder after determining the target pixel points.

[0106] Among them, the linear model can include a first linear model and a second linear model, and can also include other linear models, which are not limited here.

[0107] If the encoder determines the target pixel value of the first edge using the first linear model and the second linear model, then in step S102, the condition for determining the edge pixel points of the first edge can be: if the gray value gradient of a pixel value is greater than the target threshold and its gray value is greater than the gray values of the pixel points adjacent to its position, then determine this pixel point as an edge point.

[0108] In one implementation, the encoder can, according to the first linear model, for each pixel point on the connected curve of the first edge, determine one pixel point as the target pixel point corresponding to the pixel point on this connected curve. Finally, the target pixel points corresponding to each pixel point on the obtained connected curve are the target pixel points of the first edge. Among them, taking pixel point b as an example for the method of determining the target pixel point of the pixel point on the connected curve, please refer to Figure 4 , as Figure 4 shown, b is any pixel point on the connected curve, then the target pixel point of b can be c as shown in the figure. Due to the condition limitation of step S102, c is a pixel point with a pixel value smaller than b.

[0109] In another implementation, the encoder can, according to the second linear model, for each pixel point on the connected curve of the first edge, determine three pixel points as the target pixel points corresponding to the pixel point on this connected curve. Finally, the target pixel points corresponding to each pixel point on the obtained connected curve are the target pixel points of the first edge. Among them, taking pixel point b as an example for the method of determining the target pixel point of the pixel point on the connected curve, please refer to Figure 4 , as Figure 4 shown, b is any pixel point on the connected curve, then the target pixel points of b can be a, c, and d as shown in the figure. Due to the condition limitation of step S102, c is a pixel point with a pixel value smaller than b, and the pixel value of a is greater than the pixel value of c.

[0110] For example, the indication information indicating the position of the target pixel point can be the value of the descending direction. As Figure 5 shown, Figure 5 is a schematic diagram showing the position of the target pixel point provided by an embodiment of the present application. As Figure 5 shown, the first point and the second point are two points located on the connected curve. The pixel value of the first point is 11, and the pixel value of the second point is 12. Taking the first point as the starting point of the arrow and the next pixel point of the first point on the connected curve (i.e., the second point) as the pointing end point of the arrow, the arrow rotates counterclockwise, and the first adjacent pixel point of the first point reached is the third point. As Figure 5As shown, for the pixel points with a pixel value of 2 at the third point, since the pixel value of the third point is less than that of the first point, the encoder can take the value of 1 in the downward direction, and vice versa for 0. Then, during the encoding process, the encoder can also encode the value in the downward direction and send it to the decoder so that the decoder can determine the target pixel points according to the decoded value in the downward direction.

[0111] It should be noted that when the image to be encoded contains multiple edges, the encoder can determine the target pixel points corresponding to each edge according to the connected curve corresponding to each edge.

[0112] S105. Obtain a compensation value according to the pixel values of all pixel points and target pixel points on the connected curve in the image to be encoded.

[0113] Specifically, taking the above-mentioned first edge as an example, the encoder can calculate the compensation value of this edge according to the pixel points and target pixel points of the first edge in the image to be encoded.

[0114] In some embodiments, if the target pixel points of the first edge are determined according to the first linear model, the number of target pixel points of the first edge is equal to the number N of the first edge. Then, the steps for the encoder to calculate the compensation value of the first edge may include:

[0115] First, the encoder first calculates the sum of the pixel values of all pixel points on the connected curve in the image to be encoded, determines the sum of the pixel values of all pixel points on the connected curve in the image to be encoded as the first pixel value, then calculates the average value of the pixel values of the target pixel points in the image to be encoded, determines the average value of the pixel values of the target pixel points in the image to be encoded as the second pixel value. Furthermore, the difference between the first pixel value and the second pixel value is obtained, and the difference W between the first pixel value and the second pixel value is obtained. Finally, the compensation value of the first edge is determined to be W.

[0116] In some other embodiments, if the target pixel points of the first edge are determined according to the second linear model, the encoder can determine a first compensation value and a second compensation value. The first compensation value is the compensation value for all b and c, and the second compensation value is the compensation value for all a and.

[0117] It should be noted that the first image includes multiple edges, and the server can calculate the compensation value corresponding to each edge in the image to be encoded respectively according to the above relevant content. Among them, the linear models used for each edge can be different, which is not limited here.

[0118] S106. Smooth all pixel points and target pixel points on the connected curve in the image to be encoded according to the compensation value to obtain the first image.

[0119] Specifically, taking the first edge as an example, if the compensation value of the first edge is calculated according to the first linear model, the specific steps for the encoder to smooth the first edge may include:

[0120] The encoder subtracts the compensation value from the pixel values of all pixel points on the connected curve of the first edge in the image to be encoded, and adds the compensation value to the pixel values of all pixel points on the target pixel points of the first edge in the image to be encoded, so as to obtain the smoothed first edge.

[0121] If the image to be encoded only includes the first edge, after smoothing the first edge, the first image is obtained; if the image to be encoded includes multiple edges, after smoothing each edge, the first image can be obtained.

[0122] It should be noted that for different edges of the same frame of image to be encoded, different linear models can be adopted, and different methods for edge smoothing can also be used, which are not limited herein.

[0123] It should be noted that the first linear model and the second linear model are only examples of the linear models proposed in the embodiments of the present application, and other linear models may also be included, which are not limited herein.

[0124] S107. Encode the coordinates of the at least two fitting points, the compensation value, and the first image respectively to obtain the encoded fitting point coordinates, the encoded compensation value, and the encoded first image.

[0125] Among them, the encoding methods of the encoder for different data may be different. For example, the server may use the adjacent difference encoding method to encode the coordinate values of the fitting points corresponding to the first edge. Specifically, the server may first encode the coordinates of the first fitting point, then encode the difference between the coordinates of the second fitting point and the first fitting point, then encode the difference between the coordinates of the third fitting point and the second fitting point, and so on. For another example, the server field uses entropy encoding to encode the type of the target linear model. Among them, entropy encoding includes Huffman encoding, arithmetic encoding, run-length encoding (RLE), context-based adaptive variable-length encoding (CAVLC), and context-based adaptive binary arithmetic encoding (CABAC).

[0126] It can be understood that a video is an image sequence composed of multiple frames of images. When the decoder encodes the video, the above steps can be executed for each frame of the video to realize the encoding of the entire video.

[0127] Next, in conjunction with Figure 6 The flowchart of an image decoding method provided by the embodiments of the present application shown below specifically describes the image decoding method of the embodiments of the present application. The method may include but is not limited to the following steps:

[0128] S201. Decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image respectively to obtain the fitting point coordinates, the compensation value, and the first image.

[0129] Specifically, the decoding method of the decoder corresponds one-to-one with the encoding method of the encoder.

[0130] In some embodiments, the encoder may decode the indication information indicating the position of the target pixel point, etc., which is not limited herein.

[0131] S202. Generate a fitting curve according to the fitting point coordinates and the curve model.

[0132] It should be understood that the curve model used by the decoder is the same as the curve model used by the encoder.

[0133] S203. Determine the pixels adjacent to the pixels on the fitting curve in the first image as the target pixels.

[0134] Specifically, the decoder may determine the target pixels according to the linear model agreed with the decoder, or may also determine the target pixels according to the indication information indicating the position of the target pixels of the first edge. For the specific content, refer to the relevant content in step S104, which will not be elaborated herein.

[0135] S204. Compensate all the pixels on the fitting curve and the target pixels in the first image according to the compensation value to obtain the compensated image.

[0136] Specifically, taking the first edge as an example, the first edge is the edge processed according to the first linear model. The decoder may add the compensation value to the pixel values of all the pixels on the fitting curve of the first edge in the first image and then subtract the compensation value from the pixel values of the target pixels corresponding to the first edge in the first image to obtain the compensated image.

[0137] In one implementation, the decoder may generate a compensation image with the same size as the first image according to the coordinates of the fitting curve, the coordinates of the target pixels, and the compensation value. For example, in the case of processing the first edge according to the first linear model, the pixel value of the pixel on the fitting curve in the compensation image is the absolute value of the compensation value, and the pixel value of the target pixel in the compensation image is the negative value of the compensation value. Then, the decoder superimposes the compensation image and the first image to obtain the compensated image.

[0138] In some embodiments, when the first image includes multiple edges, the decoder may compensate each edge according to the compensation value corresponding to each edge among the multiple edges respectively, and finally, obtain the compensated image.

[0139] It can be understood that a video is an image sequence composed of multiple frames of images. When the decoder decodes the video, the above steps can be executed for each frame of the video to achieve the decoding of the entire video.

[0140] As Figure 7A shown, Figure 7A FIG. 3 is a schematic structural diagram of an encoder 30 provided by an embodiment of the present application. The encoder 30 may at least include:

[0141] A first acquisition unit 301, configured to acquire an image to be encoded;

[0142] A detection unit 302, configured to perform edge detection on the image to be encoded to obtain at least one edge, where the edge is composed of M pixel points, and M is a positive integer greater than 1;

[0143] A second acquisition unit 303, configured to acquire at least two fitting points from the M pixel points, and the proximity degree between a target fitting curve generated according to the at least two fitting points and a curve model and a connected curve determined by the edge is less than a target threshold, where the connected curve is composed of N pixel points among the M pixel points, any two adjacent pixel points among the N pixel points are adjacent in position, and N is a positive integer less than M and greater than 1;

[0144] A determination unit 304, configured to determine pixel points adjacent in position to the pixel points on the connected curve in the image to be encoded as target pixel points;

[0145] A calculation unit 305, configured to obtain a compensation value according to the pixel values of all pixel points on the connected curve and the target pixel points in the image to be encoded;

[0146] A smoothing unit 306, configured to perform smoothing processing on all pixel points on the connected curve and the target pixel points in the image to be encoded according to the compensation value to obtain a first image;

[0147] An encoding unit 307, configured to encode the coordinates of the at least two fitting points, the compensation value, and the first image respectively to obtain encoded fitting point coordinates, an encoded compensation value, and an encoded first image.

[0148] The above detection unit 302 is specifically configured to:

[0149] Calculate the gray value gradient of each pixel point in the image to be encoded;

[0150] Determine pixel points with a gray value gradient greater than a target gradient value as edge pixel points, and adjacent edge pixel points are located on the same edge.

[0151] The above second acquisition unit 303 is specifically configured to:

[0152] Calculate the curvature of the above connected curve at each of the above M pixel points;

[0153] Determine the pixel points among the above M pixel points whose curvature exceeds a preset amount as fixed fitting points;

[0154] Generate a first fitting curve based on the above fixed fitting points and the above curve model;

[0155] When the degree of approximation between the above first fitting curve and the above connected curve is not less than the above target threshold, select at least one undetermined fitting point from the above M pixel points;

[0156] Generate a second fitting curve based on the above fixed fitting points, the selected undetermined fitting points and the above curve model;

[0157] When the degree of approximation between the above second fitting curve and the above connected curve is not less than the above target threshold, repeatedly execute the above steps of selecting at least one undetermined fitting point from the above M pixel points and generating the second fitting curve based on the above fixed fitting points and the selected undetermined fitting points;

[0158] When the degree of approximation between the above second fitting curve and the above connected curve is less than the above target threshold, determine the above at least two fitting points as the above fixed fitting points and the selected undetermined fitting points.

[0159] The number of the above target pixel points is the above N, and the above calculation unit 305 is specifically configured to:

[0160] Obtain a compensation value according to the pixel values of all pixel points on the above connected curve and the above target pixel points in the above to-be-encoded image, including:

[0161] Determine the first pixel value as the average value of the pixel values of all pixel points on the above connected curve in the above to-be-encoded image;

[0162] Determine the second pixel value as the average value of the pixel values of the above target pixel points in the above to-be-encoded image;

[0163] Determine the above compensation value as W, where W is the difference between the above first pixel value and the above second pixel value.

[0164] The above smoothing unit 306 is specifically configured to:

[0165] Determine that the pixel value of the first pixel value on the above connected curve in the above first image is the difference between the pixel value of the above first pixel point in the above to-be-encoded image and the above compensation value, and the above first pixel point is any pixel point on the above connected curve;

[0166] Determine that the pixel value of the second pixel point among the target pixel points in the first image is the sum of the pixel value of the second pixel point in the image to be encoded and the compensation value, where the second pixel point is any one of the target pixel points.

[0167] The units or modules described as separate components may or may not be physically separated. The components described as units or modules may or may not be physical units, that is, they may be located in one device or may be distributed across multiple devices. The solutions of the embodiments in this disclosure can be implemented by selecting some or all of the units according to actual needs.

[0168] As Figure 7B shown, Figure 7B FIG. 10 is a schematic structural diagram of a decoder 40 provided by an embodiment of the present application. The decoder 40 may at least include:

[0169] A decoding unit 401, configured to separately decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image to obtain the fitting point coordinates, the compensation value, and the first image;

[0170] A fitting unit 402, configured to generate a fitting curve according to the fitting points and the curve model;

[0171] A determining unit 403, configured to determine the pixel points adjacent to the pixel points located on the fitting curve in the first image as target pixel points;

[0172] A compensation unit 404, configured to compensate all the pixel points located on the fitting curve and the target pixel points in the first image according to the compensation value to obtain a compensated image.

[0173] The compensation unit 404 is specifically configured to:

[0174] Add the compensation value to the pixel values of all the pixel points located on the fitting curve in the first image;

[0175] Subtract the compensation value from the pixel values of the target pixel points in the first image to obtain the compensated image.

[0176] The units or modules described as separate components may or may not be physically separated. The components described as units or modules may or may not be physical units, that is, they may be located in one device or may be distributed across multiple devices. The solutions of the embodiments in this disclosure can be implemented by selecting some or all of the units according to actual needs.

[0177] As Figure 8A shown,Figure 8A FIG. Figure 8A is a schematic structural diagram of an encoder provided by an embodiment of the present application. The encoder may include: a processor 501, a memory 502, a communication bus 503, and a communication interface 504. The processor 501 is connected to the memory 502 and the communication interface 503 through the communication bus.

[0178] The processor 501 may be a central processing unit (CPU), and the processor 501 may also be other general-purpose processors, 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, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor 501 may also be any conventional processor, etc.

[0179] The processor 501 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the image encoding method of the present application may be completed by the integrated logic circuit in the hardware of the processor 501 or the instructions in the form of software. The above-mentioned processor 501 may also be a general-purpose processor, digital signal processor (DSP), application specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application may be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, register, etc. This storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and executes the encoding method of the method embodiment of the present application in combination with its hardware.

[0180] The memory 502 can be a Read-Only Memory (ROM), a Random Access Memory (RAM), or other memories. In the embodiments of the present application, the memory 502 is used to store data and various software programs, such as the program for implementing the encoding method in the embodiments of the present application according to the function position relationship, etc.

[0181] Optionally, in the embodiments of the present application, the above-mentioned memory may include a physical device for storing information, usually by digitizing the information and then storing it in a medium using methods such as electricity, magnetism, or optics. The above-mentioned memory in this embodiment can further include: a device for storing information using electrical energy, such as RAM, ROM, etc.; a device for storing information using magnetic energy, such as a hard disk, a floppy disk, a magnetic tape, a magnetic core memory, a magnetic bubble memory, a USB flash drive; a device for storing information using optical methods, such as a CD or a DVD. Of course, there are also other types of memories, such as quantum memories, graphene memories, and so on.

[0182] The communication interface 504 uses a transceiver device such as, but not limited to, a transceiver to implement the communication between the encoding device 50 and other devices or communication networks. For example, a neural network model can be obtained through the communication interface 504.

[0183] Optionally, the encoder 50 may further include an artificial intelligence processor 505. The artificial intelligence processor 505 can be mounted on the main CPU (Host CPU) as a coprocessor, and the main CPU assigns tasks to it. The artificial intelligence processor 505 can implement one or more operations involved in the above encoding method. For example, taking the neural network processing unit (NPU) as an example, the core part of the NPU is the arithmetic circuit, and the arithmetic circuit is controlled by the controller to extract matrix data from the memory 502 and perform multiplication and addition operations.

[0184] In the embodiments of the present application, the above-mentioned artificial intelligence processor 505 is also called a dedicated processor, a processor for a specific application or field. For example: a Graphics Processing Unit (GPU), also known as a display core, a visual processor, a display chip, is a dedicated processor for image operation work on personal computers, workstations, game consoles, and some mobile devices (such as tablets, smartphones, etc.). Another example: a Neural Processing Unit (NPU), is a dedicated processor for matrix multiplication operations in the application of the field of artificial intelligence, adopting an architecture of "data-driven parallel computing", and is particularly good at processing massive multimedia data such as videos and images.

[0185] Optionally, the artificial intelligence processor may be an artificial intelligence processor with a reconfigurable architecture. Here, a reconfigurable architecture means that if an artificial intelligence processor can utilize reusable hardware resources and flexibly change its own architecture according to different application requirements in order to provide a matching architecture for each specific application requirement, then this artificial intelligence processor is called a reconfigurable computing system, and its architecture is called a reconfigurable architecture.

[0186] The above-mentioned processor 501 is used to call the data and program code in the above-mentioned memory 502 and execute:

[0187] Obtain the image to be encoded;

[0188] Perform edge detection on the above-mentioned image to be encoded to obtain at least one edge, where the edge is composed of M pixel points, and M is a positive integer greater than 1;

[0189] Obtain at least two fitting points from the above-mentioned M pixel points. The proximity degree between the target fitting curve generated according to the above-mentioned at least two fitting points and the curve model and the connected curve determined by the above-mentioned edge is less than the target threshold. The connected curve is composed of N pixel points among the above-mentioned M pixel points, and the positions of any two adjacent pixel points among the above-mentioned N pixel points are adjacent. N is a positive integer less than M and greater than 1;

[0190] Determine the pixel points adjacent to the pixel points on the above-mentioned connected curve in the above-mentioned image to be encoded as target pixel points;

[0191] Obtain a compensation value according to the pixel values of all pixel points on the above-mentioned connected curve and the above-mentioned target pixel points in the above-mentioned image to be encoded;

[0192] Perform smoothing processing on all pixel points on the above-mentioned connected curve and the above-mentioned target pixel points in the above-mentioned image to be encoded according to the above-mentioned compensation value to obtain a first image;

[0193] Encode the coordinates of the above-mentioned at least two fitting points, the above-mentioned compensation value, and the above-mentioned first image respectively to obtain the encoded fitting point coordinates, the encoded compensation value, and the encoded first image.

[0194] In one possible implementation, when the processor performs edge detection on the above-mentioned image to be encoded to obtain at least one edge, it may include:

[0195] Calculate the gray value gradient of each pixel point in the above-mentioned image to be encoded;

[0196] Determine the pixel points with gray value gradients greater than the target gradient value as edge pixel points, and the edge pixel points with adjacent positions are located on the same edge.

[0197] In one possible implementation, the processor obtains at least two fitting points from the above-mentioned M pixel points, which may include:

[0198] Calculate the curvature of the above-mentioned connected curve at each of the above-mentioned M pixel points;

[0199] Determine the pixel points among the above-mentioned M pixel points with curvature exceeding a preset amount as fixed fitting points;

[0200] Generate a first fitting curve based on the above-mentioned fixed fitting points and the above-mentioned curve model;

[0201] When the degree of approximation between the above-mentioned first fitting curve and the above-mentioned connected curve is not less than the above-mentioned target threshold, select at least one undetermined fitting point from the above-mentioned M pixel points;

[0202] Generate a second fitting curve based on the above-mentioned fixed fitting points, the selected undetermined fitting points, and the above-mentioned curve model;

[0203] When the degree of approximation between the above-mentioned second fitting curve and the above-mentioned connected curve is not less than the above-mentioned target threshold, repeatedly execute the above steps of selecting at least one undetermined fitting point from the above-mentioned M pixel points and generating the second fitting curve based on the above-mentioned fixed fitting points and the selected undetermined fitting points;

[0204] When the degree of approximation between the above-mentioned second fitting curve and the above-mentioned connected curve is less than the above-mentioned target threshold, determine the above-mentioned at least two fitting points as the above-mentioned fixed fitting points and the selected undetermined fitting points.

[0205] In one possible implementation, the number of the above-mentioned target pixel points is N, and the processor obtains a compensation value according to the pixel values of all pixel points on the above-mentioned connected curve and the above-mentioned target pixel points in the above-mentioned to-be-encoded image, which may include:

[0206] Determine the first pixel value as the average value of the pixel values of all pixel points on the above-mentioned connected curve in the above-mentioned to-be-encoded image;

[0207] Determine the second pixel value as the average value of the pixel values of the above-mentioned target pixel points in the above-mentioned to-be-encoded image;

[0208] Determine the above-mentioned compensation value as W, where W is the difference between the above-mentioned first pixel value and the above-mentioned second pixel value.

[0209] In one possible implementation, the processor performs smoothing processing on all pixel points on the above-mentioned connected curve and the above-mentioned target pixel points in the above-mentioned to-be-encoded image according to the above-mentioned compensation value to obtain a first image, which may include:

[0210] Determine that the pixel value of the first pixel on the connected curve in the first image is the difference between the pixel value of the first pixel point in the image to be encoded and the compensation value, where the first pixel point is any pixel point on the connected curve;

[0211] Determine that the pixel value of the second pixel point among the target pixel points in the first image is the sum of the pixel value of the second pixel point in the image to be encoded and the compensation value, where the second pixel point is any pixel point among the target pixel points.

[0212] The specific functions implemented by its memory and processor can be explained in contrast to the foregoing embodiments in this specification, and can achieve the technical effects of the foregoing embodiments, which will not be elaborated here.

[0213] As Figure 8B shown, Figure 8B As shown in the figure, it is a schematic structural diagram of a decoder provided by an embodiment of the present application. The decoder may include: a processor 601, a memory 602, a communication bus 603, and a communication interface 604. The processor 601 is connected to the memory 602 and the communication interface 603 through the communication bus.

[0214] The processor 601 may be a central processing unit (CPU), and the processor 601 may also be other general-purpose processors, 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, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor 601 may also be any conventional processor, etc.

[0215] The processor 601 can also be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the image decoding method of the present application can be completed by the integrated logic circuit of the hardware in the processor 601 or the instructions in the form of software. The above-mentioned processor 601 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by the combination of the hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and combines its hardware to execute the image decoding method of the method embodiment of the present application.

[0216] The memory 602 can be a read-only memory (ROM), a random access memory (RAM), or other memories. In the embodiments of the present application, the memory 602 is used to store data and various software programs, such as the program for implementing the image decoding method in the embodiments of the present application according to the function position relationship, etc.

[0217] Optionally, in the embodiments of the present application, the above-mentioned memory can include a physical device for storing information, usually storing the information after digitization and then using a medium such as electricity, magnetism, or optics. The memory in the above-mentioned embodiment can also include: a device for storing information in an electrical energy manner, such as a RAM, a ROM, etc.; a device for storing information in a magnetic energy manner, such as a hard disk, a floppy disk, a magnetic tape, a magnetic core memory, a bubble memory, a USB flash drive; a device for storing information in an optical manner, such as a CD or a DVD. Of course, there are also other ways of memories, such as quantum memories, graphene memories, and so on.

[0218] The communication interface 604 uses a transceiver device such as, but not limited to, a transceiver to implement the communication between the image decoding device 60 and other devices or communication networks. For example, a neural network model can be obtained through the communication interface 604.

[0219] Optionally, the decoder 60 may further include an artificial intelligence processor 605. The artificial intelligence processor 605 may be mounted on the host CPU as a coprocessor, and the host CPU assigns tasks to it. The artificial intelligence processor 605 may implement one or more operations involved in the above image decoding method. For example, taking a neural network processing unit (NPU) as an example, the core part of the NPU is an arithmetic circuit, and the arithmetic circuit is controlled by a controller to extract matrix data from the memory 602 and perform multiplication and addition operations.

[0220] In the embodiments of the present application, the above artificial intelligence processor 605 is also referred to as a dedicated processor, a processor for a specific application or field. For example: a Graphics Processing Unit (GPU), also known as a display core, a vision processor, a display chip, is a dedicated processor for image operation work on personal computers, workstations, game consoles, and some mobile devices (such as tablets, smart phones, etc.). Another example: a Neural Processing Unit (NPU) is a dedicated processor for matrix multiplication operations in the application of the field of artificial intelligence, adopting an architecture of "data-driven parallel computing", and is particularly good at processing massive multimedia data such as videos and images.

[0221] Optionally, the artificial intelligence processor may be an artificial intelligence processor with a reconfigurable architecture. Here, the reconfigurable architecture means that if an artificial intelligence processor can utilize reusable hardware resources and flexibly change its own architecture according to different application requirements to provide a matching architecture for each specific application requirement, then this artificial intelligence processor is called a reconfigurable computing system, and its architecture is called a reconfigurable architecture.

[0222] The above processor 601 is used to call the data and program codes in the above memory 602 and execute:

[0223] Decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image respectively to obtain the above fitting point coordinates, the above compensation value, and the above first image;

[0224] Generate a fitting curve according to the above fitting point coordinates and the curve model;

[0225] Determine the pixel points adjacent to the pixel points located on the above fitting curve in the above first image as target pixel points;

[0226] Compensate all the pixel points on the fitting curve and the target pixel point in the first image according to the above compensation value to obtain a compensated image.

[0227] In one possible implementation, when the processor executes compensating all the pixel points on the fitting curve and the target pixel point in the first image according to the above compensation value to obtain a compensated image, it may include:

[0228] Add the compensation value to the pixel values of all the pixel points on the fitting curve in the first image;

[0229] Subtract the compensation value from the pixel value of the target pixel point in the first image to obtain the compensated image.

[0230] An embodiment of the present invention also provides a computer storage medium for storing computer software instructions used by the above encoder and decoder, which includes a program for executing the method embodiment described above. By executing the stored program, optimization of the neural network model can be achieved to reduce redundant calculations.

[0231] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.

[0232] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable encoder or decoder to generate a machine, such that the instructions executed by the processor of the computer or other programmable encoder or decoder generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0233] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable encoder or decoder to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions in the process Figure 1One or more processes and / or boxes Figure 1 The functions specified in one or more boxes.

[0234] These computer program instructions can also be loaded onto a computer or other programmable encoder or decoder, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 One or more processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes.

[0235] The embodiments of the present disclosure have been introduced in detail above. Specific examples are used in this article to elaborate on the principles and implementation manners of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure. At the same time, changes or deformations made by those skilled in the art based on the idea of the present disclosure, within the specific implementation manners and application scope of the present disclosure, all fall within the scope of protection of the present disclosure. In summary, the content of this specification should not be construed as a limitation to the present disclosure.

Claims

1. An image encoding method, characterized in that, comprising: obtaining an image to be encoded; performing edge detection on the image to be encoded to obtain at least one edge, where the edge consists of M pixel points, and M is a positive integer greater than 1; obtaining at least two fitting points from the M pixel points, and the proximity between the target fitting curve generated according to the at least two fitting points and the curve model and the connected curve determined by the edge is less than a target threshold, where the connected curve consists of N pixel points among the M pixel points, and any two adjacent pixel points among the N pixel points are adjacent in position, and N is a positive integer less than M and greater than 1; determining the pixel points adjacent to the pixel points on the connected curve in the image to be encoded as target pixel points; obtaining a compensation value according to the pixel values of all the pixel points on the connected curve and the target pixel points in the image to be encoded; performing smoothing processing on all the pixel points on the connected curve and the target pixel points in the image to be encoded according to the compensation value to obtain a first image; encoding the coordinates of the at least two fitting points, the compensation value, and the first image respectively to obtain encoded fitting point coordinates, an encoded compensation value, and an encoded first image.

2. The method according to claim 1, characterized in that, the performing edge detection on the image to be encoded to obtain at least one edge includes: calculating the gray value gradient of each pixel point in the image to be encoded; determining the pixel points with gray value gradients greater than a target gradient value as edge pixel points, and the edge pixel points adjacent in position are located on the same edge.

3. The method according to claim 1 or 2, characterized in that, the obtaining at least two fitting points from the M pixel points includes: calculating the curvature of the connected curve at each of the M pixel points; determining the pixel points with curvatures exceeding a preset amount among the M pixel points as fixed fitting points; generating a first fitting curve according to the fixed fitting points and the curve model; when the proximity between the first fitting curve and the connected curve is not less than the target threshold, selecting at least one undetermined fitting point from the M pixel points; generating a second fitting curve according to the fixed fitting points, the selected undetermined fitting points, and the curve model; when the proximity between the second fitting curve and the connected curve is not less than the target threshold, repeatedly performing the selecting at least one undetermined fitting point from the M pixel points and the generating the second fitting curve according to the fixed fitting points and the selected undetermined fitting points; when the proximity between the second fitting curve and the connected curve is less than the target threshold, determining the at least two fitting points as the fixed fitting points and the selected undetermined fitting points.

4. The method according to claim 3, characterized in that, the number of the target pixel points is N, and obtaining a compensation value according to the pixel values of all the pixel points on the connected curve and the target pixel points in the image to be encoded includes: determining a first pixel value as the average value of the pixel values of all the pixel points on the connected curve in the image to be encoded; Determine that the second pixel value is the average value of the pixel values of the target pixel point in the image to be encoded; Determine that the compensation value is W, where W is the difference between the first pixel value and the second pixel value.

5. The method according to claim 4, wherein, The smoothing process of all pixel points on the connected curve and the target pixel point in the image to be encoded according to the compensation value to obtain a first image includes: Determine that the pixel value of the first pixel point on the connected curve in the first image is the difference between the pixel value of the first pixel point in the image to be encoded and the compensation value, and the first pixel point is any pixel point on the connected curve; Determine that the pixel value of the second pixel point in the target pixel point in the first image is the sum of the pixel value of the second pixel point in the image to be encoded and the compensation value, and the second pixel point is any pixel point in the target pixel point.

6. An image decoding method, wherein, includes: Decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image obtained by the method according to any one of claims 1-5 respectively to obtain the fitting point coordinates, the compensation value, and the first image; Generate a fitting curve according to the fitting point coordinates and the curve model; Determine the pixel points adjacent to the pixel points located on the fitting curve in the first image as target pixel points; Compensate all pixel points located on the fitting curve and the target pixel points in the first image according to the compensation value to obtain a compensated image.

7. The method according to claim 6, wherein, The compensating all pixel points located on the fitting curve and the target pixel points in the first image according to the compensation value to obtain a compensated image includes: Add the compensation value to the pixel values of all pixel points on the fitting curve in the first image; Subtract the compensation value from the pixel values of the target pixel points in the first image to obtain the compensated image.

8. An encoder, wherein, includes: A first acquisition unit for acquiring an image to be encoded; A detection unit for performing edge detection on the image to be encoded to obtain at least one edge, the edge being composed of M pixel points, and M being a positive integer greater than 1; A second acquisition unit for acquiring at least two fitting points from the M pixel points, and the proximity of the target fitting curve generated according to the at least two fitting points and the curve model to the connected curve determined by the edge is less than a target threshold, the connected curve being composed of N pixel points among the M pixel points, and the positions of any two adjacent pixel points among the N pixel points are adjacent, and N is a positive integer less than M and greater than 1; A determination unit for determining the pixel points adjacent to the pixel points on the connected curve in the image to be encoded as target pixel points; A calculation unit for obtaining a compensation value according to the pixel values of all pixel points on the connected curve and the target pixel points in the image to be encoded; A smoothing unit, configured to perform smoothing processing on all pixel points on the connected curve and the target pixel point in the image to be encoded according to the compensation value, so as to obtain a first image; An encoding unit, configured to encode the coordinates of the at least two fitting points, the compensation value, and the first image respectively, so as to obtain encoded fitting point coordinates, an encoded compensation value, and an encoded first image.

9. A decoder, characterized in that, it includes: A decoding unit, configured to decode the encoded fitting point coordinates, the encoded compensation value, and the encoded first image obtained by the method according to any one of claims 1-5 respectively, so as to obtain the fitting point coordinates, the compensation value, and the first image; A fitting unit, configured to generate a fitting curve according to the fitting points and a curve model; A determining unit, configured to determine a pixel point adjacent to a pixel point located on the fitting curve in the first image as a target pixel point; A compensation unit, configured to compensate all pixel points located on the fitting curve and the target pixel point in the first image according to the compensation value, so as to obtain a compensated image.

10. A computer device, characterized in that, it includes a processor and a memory, the processor and the memory are connected to each other, wherein the processor includes a general-purpose processor and an artificial intelligence processor, the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1-7.

11. A computer-readable storage medium, characterized in that, the computer-readable storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to execute the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method for configuring video encoding quality and transmitting video data in classified mode

    CN103414900A

  • Image codec method, image coder and image decoder

    CN1358028A