Image processing method and device, electronic equipment and storage medium
By dividing the image into pixel image blocks and sub-pixel regions, determining the texture value based on brightness information, and optimizing the encoding quantization value, the problem of high computational cost in image feature detection is solved, and more efficient image coding is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING TSINGMICRO INTELLIGENT TECH CO LTD
- Filing Date
- 2026-02-10
- Publication Date
- 2026-06-23
Smart Images

Figure CN122269038A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to an image processing method and apparatus, electronic device and storage medium. Background Technology
[0002] In the field of video coding, video coding standards use peak signal-to-noise ratio as an objective quality evaluation indicator. Operations such as coding block division and coding mode selection are all based on rate-distortion coding control models. However, in practical applications, it is necessary to seek a balance between subjective video quality and coding bitrate. The detection results of image edge and texture features have important reference significance for this balance control.
[0003] In related technologies, edge point features of images are calculated using different detection operators such as the Sobel operator, Laplacian operator, and Canny operator. All detection operators use a filtering window to perform filtering on a pixel-by-pixel basis to complete the feature detection of the image. However, the pixel-by-pixel filtering mechanism results in a large amount of memory computation during the image feature detection process, which is difficult to adapt to the actual application requirements of video coding scenarios. Summary of the Invention
[0004] This disclosure provides an image processing method, apparatus, electronic device, and storage medium to solve the problem of large memory computation requirements in related technologies.
[0005] According to a first aspect of this disclosure, an image processing method is provided, comprising:
[0006] The image to be processed is divided into at least one pixel image block. Each pixel image block is processed sequentially to obtain at least one sub-pixel region corresponding to it. The target texture value of each pixel image block is determined based on the brightness information of each sub-pixel region. The texture index value of each pixel image block is determined based on the target texture value, and the correction value of each pixel image block is determined by combining the correction result of the texture index value. The corrected value is used to match the corresponding target coded quantization value from a preset coded quantization table to optimize the image to be processed.
[0007] In some embodiments of this disclosure, dividing the image to be processed into at least one pixel image block, and sequentially processing each pixel image block to obtain at least one corresponding sub-pixel region, includes: In response to the received image to be processed, the image to be processed is divided into at least one pixel image block, and each pixel image block is sampled sequentially to obtain at least one sub-pixel image block corresponding to each pixel image block. Each subpixel image block is divided into at least one subpixel region.
[0008] In some embodiments of this disclosure, determining the target texture value of each pixel image block based on the brightness information of each sub-pixel region includes: The average brightness of each sub-pixel region is determined based on all sub-pixel regions in each sub-pixel image block. The first deviation value corresponding to each sub-pixel region is determined based on the average brightness value and the brightness value of each sub-pixel point in each sub-pixel region. The target texture value of the pixel image block to which each sub-pixel region belongs is determined based on the first deviation value of each sub-pixel region.
[0009] In some embodiments of this disclosure, determining the target texture value of the pixel image block to which each sub-pixel region belongs based on the first deviation value of each sub-pixel region includes: The first target texture mean value corresponding to the sub-pixel image block is determined based on the texture values of each sub-pixel region in any sub-pixel image block; wherein, the texture value of the sub-pixel region is determined by each sub-pixel point contained in the sub-pixel region; A second deviation value for the sub-pixel region is determined based on the mean value of the first target texture and the first deviation value. Determine whether the second deviation value is greater than or equal to the preset protection threshold; If the second deviation value is determined to be greater than or equal to the preset protection threshold, the texture value of the target pixel image block to which any sub-pixel image block belongs is adjusted according to the preset texture compensation value to obtain the target texture value of the target pixel image block; If the second deviation value is determined to be less than the preset protection threshold, the texture value of any sub-pixel image block is determined as the target texture value of the target pixel image block.
[0010] In some embodiments of this disclosure, determining the texture index value of each pixel image block based on the target texture value includes: The second target texture mean value corresponding to the image to be processed is determined based on the target texture value of each pixel image block in the image to be processed; The target index threshold range of each pixel image block is determined based on the mean value of the second target texture. Based on the predefined mapping relationship between texture index values and index threshold ranges, the texture index value corresponding to the target texture value within the target index threshold range is determined.
[0011] In some embodiments of this disclosure, determining the correction value of each pixel image block by combining the correction result of the texture index value includes: The average texture index of the image to be processed is determined based on the texture index value of each pixel image block; The correction value corresponding to the mean texture index is determined based on the mean texture index and the preset texture index threshold.
[0012] In some embodiments of this disclosure, the step of matching the corresponding target coded quantization value from a preset coded quantization table with the correction value to optimize the image to be processed includes: Based on the correction value, each pixel image block is corrected to obtain the corrected texture index value; Based on the corrected texture index value, the quantization adjustment value corresponding to the corrected texture index value is obtained from the preset encoding quantization table; Based on the quantization adjustment value, the target coded quantization value of the image to be processed is determined.
[0013] According to a second aspect of this disclosure, an image processing apparatus is provided, comprising: The processing unit is used to divide the image to be processed into at least one pixel image block, and process each pixel image block in turn to obtain at least one sub-pixel region corresponding to each pixel. The first determining unit is used to determine the target texture value of each pixel image block based on the brightness information of each sub-pixel region; The second determining unit is used to determine the texture index value of each pixel image block based on the target texture value; The third determining unit is used to determine the correction value of each pixel image block by combining the correction result of the texture index value; A matching unit is used to match the corresponding target coded quantization value from a preset coded quantization table in combination with the correction value, so as to optimize the image to be processed.
[0014] In some embodiments of this disclosure, the processing unit includes: The first processing module is configured to, in response to the received image to be processed, divide the image to be processed into at least one pixel image block, and sequentially sample each pixel image block to obtain at least one sub-pixel image block corresponding to each pixel image block. The segmentation module is used to divide each subpixel image block into at least one subpixel region.
[0015] In some embodiments of this disclosure, the first determining unit includes: The first determining module is used to determine the average brightness of each sub-pixel region based on all sub-pixel regions in each sub-pixel image block; The second determining module is used to determine the first deviation value corresponding to each sub-pixel region based on the average brightness value and the brightness value of each sub-pixel point in each sub-pixel region. The third determining module is used to determine the target texture value of the pixel image block to which each sub-pixel region belongs based on the first deviation value of each sub-pixel region.
[0016] In some embodiments of this disclosure, the third determining module includes: The first determining submodule is configured to determine the first target texture mean value corresponding to the subpixel image block based on the texture values of each subpixel region in any subpixel image block; wherein, the texture value of the subpixel region is determined by each subpixel point contained in the subpixel region; The second determining submodule is used to determine the second deviation value of the subpixel region based on the first target texture mean and the first deviation value; The judgment submodule is used to determine whether the second deviation value is greater than or equal to the preset protection threshold; The adjustment submodule is used to adjust the texture value of the target pixel image block to which any sub-pixel image block belongs according to a preset texture compensation value when the second deviation value is determined to be greater than or equal to the preset protection threshold, so as to obtain the target texture value of the target pixel image block; The third determining submodule is used to determine the texture value of any subpixel image block as the target texture value of the target pixel image block when the second deviation value is determined to be less than the preset protection threshold.
[0017] In some embodiments of this disclosure, the second determining unit includes: The fourth determining module is used to determine the second target texture mean value corresponding to the image to be processed based on the target texture value of each pixel image block in the image to be processed; The fifth determining module is used to determine the target index threshold range of each pixel image block based on the mean value of the second target texture; The sixth determining module is used to determine the texture index value corresponding to the target index threshold range of the target texture value according to the predefined mapping relationship between texture index values and index threshold ranges.
[0018] In some embodiments of this disclosure, the third determining unit includes: The seventh determining module is used to determine the average texture index of the image to be processed based on the texture index value of each pixel image block; The eighth determining module is used to determine the correction value corresponding to the average texture index based on the average texture index and the preset texture index threshold.
[0019] In some embodiments of this disclosure, the matching unit includes: The second processing module is used to perform correction processing on each pixel image block based on the correction value to obtain the corrected texture index value; The query module is used to query the preset encoding quantization table to obtain the quantization adjustment value corresponding to the corrected texture index value based on the corrected texture index value; The ninth determining module is used to determine the target encoded quantization value of the image to be processed based on the quantization adjustment value.
[0020] According to a third aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect embodiment.
[0021] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect of the present disclosure.
[0022] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in the first aspect of the preceding embodiments.
[0023] In summary, the image processing method, apparatus, electronic device, and storage medium provided in this disclosure include: dividing the image to be processed into at least one pixel image block; processing each pixel image block sequentially to obtain at least one corresponding sub-pixel region; determining the target texture value of each pixel image block based on the brightness information of each sub-pixel region; determining the texture index value of each pixel image block based on the target texture value; and determining the correction value of each pixel image block in combination with the correction result of the texture index value; matching the corresponding target coded quantization value from a preset coded quantization table in combination with the correction value to optimize the image to be processed; by determining the target texture value and texture index value based on the pixel image block, and matching the target coded quantization value with the correction value determined by the texture index value, the computational complexity of feature extraction is reduced, while the target coded quantization value conforms to the image content features, thereby optimizing the encoding effect of the image.
[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0025] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 This is a schematic flowchart of an image processing method provided in an embodiment of the present disclosure; Figure 2 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 3 This is a schematic diagram of a pixel image block provided in an embodiment of the present disclosure; Figure 4 This is a schematic diagram of a subpixel image block provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of a subpixel region provided in an embodiment of the present disclosure; Figure 6 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 7 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 8 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 9 This is a schematic diagram illustrating the mapping relationship between texture index values and index threshold ranges provided in an embodiment of this disclosure; Figure 10 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 11 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 12 This is a schematic flowchart of another image processing method provided in an embodiment of the present disclosure; Figure 13 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of the present disclosure; Figure 14 This is a schematic diagram of another image processing apparatus provided in an embodiment of the present disclosure; Figure 15 A schematic block diagram of an example electronic device provided for embodiments of this disclosure. Detailed Implementation
[0026] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0027] The image processing method, apparatus, electronic device, and storage medium of the present disclosure are described below with reference to the accompanying drawings.
[0028] This invention has a wide range of applications, especially in video encoding IP, video encoding chips, and various terminal products involving video encoding bitrate control strategies, where it has significant application value.
[0029] Figure 1 This is a schematic flowchart of an image processing method provided in an embodiment of the present disclosure.
[0030] like Figure 1 As shown, the method includes the following steps: Step 101: Divide the image to be processed into at least one pixel image block, process each pixel image block in turn to obtain at least one sub-pixel region, and determine the target texture value of each pixel image block based on the brightness information of each sub-pixel region.
[0031] In some embodiments, the image to be processed can be a video frame or a still image of any resolution. The size of the pixel image blocks obtained by dividing the image to be processed includes, but is not limited to, 64×64, 32×32, 16×16, etc., and the images are divided according to the pixel arrangement order or any other division method. The specific division method and the size of the pixel image blocks are not limited, ensuring that all pixels in the image to be processed are contained in the corresponding pixel image blocks. When processing each pixel image block, sampling processing is first used to obtain the corresponding sub-pixel image blocks. The sampling method includes, but is not limited to, mean sampling, maximum sampling, and phase sampling, etc., and the specific sampling method is not limited. After obtaining the sub-pixel image... After the image block is processed, the subpixel image block is divided into at least one subpixel region. The division method is consistent with the division logic of the pixel image block. For example, an 8×8 subpixel image block can be divided into four 4×4 subpixel regions. The above example is only for illustration and the specific number of subpixel regions is not limited. The brightness information includes the brightness data of each image block in the subpixel region and the statistical information based on the brightness data. When determining the target texture value based on the brightness information, the brightness information of the subpixel region is calculated and processed to obtain the texture value that can reflect the texture characteristics of the pixel image block. Then, the texture value is judged in combination with the preset texture adjustment conditions, and the final target texture value is determined according to the judgment result.
[0032] The above method can accurately extract the texture features of pixel image blocks and determine the target texture value through region segmentation and brightness information analysis, providing a reliable texture feature basis for matching encoding parameters.
[0033] Step 102: Determine the texture index value of each pixel image block based on the target texture value, and determine the correction value of each pixel image block in combination with the correction result of the texture index value.
[0034] In some embodiments, the texture index value is the identification information obtained after discretizing the target texture value. When determining the texture index value, a unified classification standard is determined based on the target texture values of all pixel image blocks, and the target texture values are classified according to the classification standard. Each category of target texture values corresponds to a unique texture index value. The correction result of the texture index value is the adjustment basis obtained after statistical analysis of the texture index values of all pixel image blocks in the image to be processed. The statistical analysis method includes statistical means such as calculating the mean of all texture index values. The correction value is the parameter used to adjust the texture index value based on the correction result. The correction value corresponding to each pixel image block is uniformly determined based on the statistical results of the overall texture index value to ensure the consistency of the correction logic.
[0035] The above method converts continuous target texture values into discrete texture index values, simplifies the matching logic of encoding parameters, and determines correction values based on overall statistical results, so that the adjustment of texture index values fits the overall texture feature distribution of the image and ensures the rationality of the adjustment.
[0036] Step 103: Combine the correction value with the corresponding target coded quantization value from the preset coded quantization table to optimize the image to be processed.
[0037] In some embodiments, the preset coding quantization table is a pre-configured correspondence table between correction values and coding quantization values, which can be reused after configuration. The correspondence rules between coding quantization values and correction values in this table are pre-defined rules. When matching with correction values, the texture index value of each pixel image block is combined with the corresponding correction value. The combination method includes, but is not limited to, the accumulation of texture index value and correction value, weighted summation of texture index value and correction value, etc. The specific combination method is not limited, and the corrected texture index value is obtained. Based on the corrected texture index value, the corresponding coding quantization value is queried in the preset coding quantization table. This coding quantization value is the target coding quantization value of the pixel image block. The target coding quantization values of all pixel image blocks are applied to the coding process of the image to be processed to achieve optimization of the image to be processed.
[0038] The above method utilizes a preset encoding quantization table to achieve rapid matching of the target encoding quantization value, ensuring the standardization of the encoding process. At the same time, the texture index value is adjusted by the correction value to ensure that the target encoding quantization value accurately corresponds to the texture features of the pixel image block, effectively achieving encoding optimization of the image to be processed.
[0039] In summary, according to the image processing method provided in this disclosure, the method includes: dividing the image to be processed into at least one pixel image block; processing each pixel image block sequentially to obtain at least one corresponding sub-pixel region; determining the target texture value of each pixel image block based on the brightness information of each sub-pixel region; determining the texture index value of each pixel image block based on the target texture value; and determining the correction value of each pixel image block in combination with the correction result of the texture index value; matching the corresponding target coding quantization value from a preset coding quantization table in combination with the correction value to optimize the image to be processed; by determining the target texture value and texture index value based on the pixel image block, and matching the target coding quantization value with the correction value determined by the texture index value, the computational complexity of feature extraction is reduced, while the coding quantization parameters are made more consistent with the image content features, thereby optimizing the coding effect of the image.
[0040] Figure 2 A flowchart illustrating an image processing method provided by an embodiment of this disclosure is further shown. For example... Figure 2 As shown, the method includes the following steps: Step 201: In response to the received image to be processed, the image to be processed is divided into at least one pixel image block, and each pixel image block is sampled sequentially to obtain at least one sub-pixel image block corresponding to each pixel image block.
[0041] In some embodiments, the image to be processed is divided into at least one pixel image block according to the coding block size. The size of the pixel image block includes, but is not limited to, 64×64, 32×32, 16×16, etc. After division, it is ensured that all image blocks of the image to be processed are assigned to the corresponding pixel image block. The sampling processing performed on each pixel image block is downsampling processing. The downsampling method includes, but is not limited to, averaging mode, maximum mode, and phase mode. Taking a 16×16 pixel image block as an example, it is downsampled by one-quarter using the averaging mode to obtain an 8×8 sub-pixel image block. Downsampling processing reduces the computational load of the operator without affecting the effect of subjective optimization of the coding. It should be noted that the above examples are only illustrative and do not limit the specific content.
[0042] Step 202: Divide each subpixel image block into at least one subpixel region.
[0043] In some embodiments, based on the requirement to adapt to encoding pixel image block sizes of different dimensions, the downsampled subpixel image block is divided according to a preset size to obtain at least one subpixel region. Taking an 8×8 subpixel image block as an example, the subpixel image block is divided into four equal 4×4 subpixel regions. By dividing the same subpixel image block into different subpixel regions, a basis is provided for calculating the texture values of different pixel image blocks. It should be noted that the above examples are merely illustrative and do not limit the specific content.
[0044] The above method reduces the computational load of image processing through downsampling, and adapts to the needs of different pixel image block sizes by dividing the image block into different pixel sizes, avoiding the cumbersome operation of traditional pixel-level filtering, and conforming to the logic of the encoder based on image block processing.
[0045] As a feasible approach, Figure 3 This is a schematic diagram of a pixel image block provided in an embodiment of the present disclosure, as shown below. Figure 3 The image shown illustrates the process of downsampling a 16×16 pixel image block using an averaging mode. After downsampling, the original 16×16 pixel image block is transformed into... Figure 4 The image shown is an 8×8 subpixel patch; Figure 4 This is a schematic diagram of a subpixel image block provided in an embodiment of the present disclosure, as shown below. Figure 4 The image shown illustrates the division of an 8×8 subpixel image block. Figure 3 Pixels in a pixel image block , , , , , , , , , , , , , , , For example, calculate Figure 4 Sub-pixels in a medium-subpixel image patch , , , The formula is as follows:
[0046] The 8×8 subpixel image block is divided equally as follows: Figure 5The four 4×4 subpixel regions shown completely cover the 8×8 subpixel image block. Figure 5 This is a schematic diagram of a sub-pixel region provided in an embodiment of the present disclosure, such as... Figure 5 The image shown is a 4×4 subpixel region, through which the texture complexity of the image is calculated.
[0047] Figure 6 A flowchart illustrating an image processing method provided by an embodiment of this disclosure is further shown. For example... Figure 6 As shown, the method includes the following steps: Step 301: Determine the average brightness of each sub-pixel region based on all sub-pixel regions in each sub-pixel image block.
[0048] In some embodiments, for each sub-pixel region obtained by dividing the downsampled sub-pixel image block, the average brightness of all sub-pixels in each sub-pixel region is calculated. Taking the division of 4 sub-pixel regions as an example, the formulas for the average brightness of all sub-pixels in the 4 sub-pixel regions are as follows: Average brightness of all sub-pixels in the upper left region: Average brightness of all sub-pixels in the upper right region: Average brightness of all sub-pixels in the lower left region: Average brightness of all sub-pixels in the lower right region: ,in, This represents any sub-pixel within each sub-pixel region. It should be noted that there is no limit to the number of specific sub-pixel regions.
[0049] Step 302: Determine the first deviation value corresponding to each sub-pixel region based on the average brightness value and the brightness value of each sub-pixel point in each sub-pixel region.
[0050] In some embodiments, the first deviation value is the difference between the brightness value of each sub-pixel point within the sub-pixel region and the average brightness value of the sub-pixel region. , , , The sum of the absolute values of the residuals, taking the division into 4 sub-pixel regions as an example, is calculated using the formula for the first deviation value of the upper left region: The first deviation value in the upper right region: The first deviation value in the lower left region: The first deviation value in the lower right region: ,in, This refers to any sub-pixel within each sub-pixel region. It should be noted that there is no limit to the number of specific sub-pixel regions.
[0051] Step 303: Determine the target texture value of the pixel image block to which each sub-pixel region belongs based on the first deviation value of each sub-pixel region.
[0052] In some embodiments, the texture value of the pixel image block to which each sub-pixel region belongs is the first deviation value of its corresponding sub-pixel region ( , , , The sum of the values of the pixels in the image, taking the division into 4 sub-pixel regions as an example, is the texture value of the pixel image block to which each sub-pixel region belongs. The calculation formula is The target texture value is determined by using this texture value after edge protection processing. It should be noted that there is no limit to the number of sub-pixel regions that can be divided.
[0053] The above method divides the downsampled image data into blocks and calculates texture-related parameters. It reduces computational complexity by avoiding point-by-point calculation using a filter window. At the same time, it accurately obtains the texture complexity data of pixel image blocks based on the brightness information of sub-pixel points.
[0054] Figure 7 A flowchart illustrating an image processing method provided by an embodiment of this disclosure is further shown. For example... Figure 7 As shown, the method includes the following steps: Step 401: Determine the first target texture mean value corresponding to the sub-pixel image block based on the texture values of each sub-pixel region in any sub-pixel image block; wherein, the texture value of the sub-pixel region is determined by each sub-pixel point contained in the sub-pixel region.
[0055] In some embodiments, the texture value of a subpixel region is a first deviation value for that subpixel region. This first deviation value is calculated based on the brightness value of each subpixel point contained in the subpixel region. Taking the division into four subpixel regions as an example, any subpixel image block corresponds to four subpixel regions, and the first target texture mean value... The first deviation value of the four sub-pixel regions ( , , , The average value of ) is calculated using the following formula: ,in, This represents the texture value of the pixel image block to which each sub-pixel region belongs.
[0056] Step 402: Determine the second deviation value of the sub-pixel region based on the first target texture mean and the first deviation value.
[0057] In some embodiments, the second deviation value is the sum of the absolute values of the residuals between the first deviation values of all sub-pixel regions in the sub-pixel image patch and the mean of the first target texture. Taking the division of 4 sub-pixel regions as an example, based on the mean of the first target texture... and the first deviation value of each sub-pixel region ( , , , Then determine the second deviation value. The calculation formula is It should be noted that there is no limit to the number of specific sub-pixel regions that can be divided.
[0058] Step 403: Determine whether the second deviation value is greater than or equal to the preset protection threshold.
[0059] In some embodiments, the preset protection threshold is The threshold is a pre-configured fixed value, and the calculated second deviation value... With preset protection threshold The comparison is performed to determine whether the edge information within the block needs to be protected.
[0060] Step 404: If the second deviation value is determined to be greater than or equal to the preset protection threshold, the texture value of the target pixel image block to which any sub-pixel image block belongs is adjusted according to the preset texture compensation value to obtain the target texture value of the target pixel image block.
[0061] In some embodiments, the preset texture compensation value is ,when When this occurs, it indicates that the target pixel image block has rich texture and important edge information, and its texture value needs to be adjusted. The formula for calculating the target texture value is: By superposition To update the target texture value.
[0062] Step 405: If it is determined that the second deviation value is less than the preset protection threshold, the texture value of any sub-pixel image block is determined as the target texture value of the target pixel image block.
[0063] In some embodiments, when When the target pixel image block is flat and has little texture information, it does not require protection, and the texture value of the target pixel image block is used as the target texture value.
[0064] The above method achieves the protection of edge information within the target pixel image block, thus ensuring the subjective effect of the edge region in the image.
[0065] Figure 8A flowchart illustrating an image processing method provided by an embodiment of this disclosure is further shown. For example... Figure 8 As shown, the method includes the following steps: Step 501: Determine the second target texture mean value corresponding to the image to be processed based on the target texture value of each pixel image block in the image to be processed.
[0066] In some embodiments, the second target texture mean is the average of the target texture values of all pixel image blocks in the current frame's image to be processed. Taking a 16×16 pixel image block (Cu16) as an example, the second target texture mean... The calculation formula is ,in, This represents the target texture value of a 16×16 pixel image block. Indicates the coordinate index within the frame. Represents the ordinate of a pixel image block. Represents the x-coordinate of a pixel image block.
[0067] Step 502: Determine the target index threshold range of each pixel image block based on the mean value of the second target texture.
[0068] In some embodiments, based on the second target texture mean, a multi-level target index threshold range is divided by segmented mapping. Taking the implementation of a 9-level texture index as an example, the texture value range derived based on the second target texture mean is divided into 9 continuous and non-overlapping threshold intervals, and each interval is a target index threshold range.
[0069] Step 503: Determine the texture index value corresponding to the target index threshold range of the target texture value according to the predefined mapping relationship between texture index values and index threshold ranges.
[0070] In some embodiments, a predefined texture index value and an index threshold range are mapped to each other. For example, a 9-level texture index corresponds to 9 target index threshold ranges. The target index threshold ranges after dividing the target texture value of each pixel image block are matched to determine the index threshold range to which the target texture value belongs. The texture index value of the pixel image block is determined according to the value corresponding to the index threshold range.
[0071] The above method converts floating-point target texture values into discretized texture index values, which satisfies the requirements of encoding parameter mapping, simplifies the calculation logic, and reduces the computational complexity.
[0072] As a feasible approach, Figure 9 This is a schematic diagram illustrating the mapping relationship between texture index values and index threshold ranges provided in an embodiment of this disclosure, as shown below. Figure 9As shown, this illustrates the one-to-one correspondence between the 9-level texture index values and the 9 target index threshold ranges. The first column represents the index threshold ranges divided based on the average value of the second target texture. Determine the index threshold range ([0, ...)) ), [ , ), [ , ), [ , ), [ , ), [ , ), [ , ), [ , ), [ , The second column contains the corresponding level 9 texture index values. (Values range from 0 to 8), each index threshold range corresponds to a texture index value, used to quickly match the target texture value to obtain the corresponding texture index value. It should be noted that the coefficients involved and the specific index threshold range can be configured according to the actual situation, and there is no specific limitation.
[0073] Figure 10 A flowchart illustrating an image processing method provided by an embodiment of this disclosure is further shown. For example... Figure 10 As shown, the method includes the following steps: Step 601: Determine the average texture index of the image to be processed based on the texture index values of each pixel image block.
[0074] In some embodiments, the mean texture index is the average of the texture index values of all pixel image blocks in the current frame's image to be processed. Taking a 16×16 pixel image block (Cu16) as an example, the mean texture index... The calculation formula is ,in, This represents the texture index value of a 16×16 pixel image patch. Indicates the coordinate index within the frame. Represents the ordinate of a pixel image block. Represents the x-coordinate of a pixel image block.
[0075] Step 602: Determine the correction value corresponding to the mean texture index based on the mean texture index and the preset texture index threshold.
[0076] In some embodiments, taking a 9-level texture index as an example, the preset texture index threshold is the median value (e.g., 4) corresponding to the 9-level texture index. The mean texture index is calculated first. The deviation from the preset texture index threshold (e.g., 4) is corrected by the following value: The calculation formula is The calculation of the correction value includes saturation processing.
[0077] The above method addresses the problem of uneven texture index value distribution caused by image content (such as large flat areas or complex texture areas), discretization segmentation mapping, and edge protection correction. It corrects the texture index values as a whole, making the average texture index value fit the preset middle position, thus ensuring the rationality of the encoding parameter matching.
[0078] Figure 11 A flowchart illustrating an image processing method provided by an embodiment of this disclosure is further shown. For example... Figure 11 As shown, the method includes the following steps: Step 701: Based on the correction value, perform correction processing on each pixel image block to obtain the corrected texture index value.
[0079] In some embodiments, the texture index value and the correction value of each pixel image block are summed to complete the texture index value correction process, resulting in the corrected texture index value. The calculation formula is as follows: ,in, This represents the texture index value of the corrected 16×16 pixel image block. Ensure the correction value falls within the texture index range of 0-8. This indicates that the previous texture index value has been corrected. This indicates the correction value, during which saturation processing is retained.
[0080] Step 702: Based on the corrected texture index value, query the preset encoding quantization table to obtain the quantization adjustment value corresponding to the corrected texture index value.
[0081] In some embodiments, the preset encoding quantization table is a pre-established mapping table between texture index values and encoding quantization values. Taking a 9-level texture index as an example, this table contains texture index values corrected from levels 0 to 8. The one-to-one correspondence between the texture index value and the corresponding quantization adjustment value follows the rule that the smaller the texture index value, the smaller the quantization adjustment value; and the larger the texture index value, the larger the quantization adjustment value. The quantization adjustment values are preset in array form. The corrected texture index value (ranging from 0 to 8) is directly used as the index of the array. The corresponding quantization adjustment value is retrieved by looking up this index in the array. For example, when the corrected texture index value is 0, the quantization adjustment value is -4; when the corrected texture index value is 8, the quantization adjustment value is +4. It should be noted that the above examples are merely illustrative and do not limit the specific implementation.
[0082] Step 703: Based on the quantization adjustment value, determine the target coded quantization value of the image to be processed.
[0083] In some embodiments, the formula for calculating the target encoded quantization value is as follows: ,in, The base quantization value determined for coding rate control. This is the corrected texture index value (corresponding to values 0-8 of a 9-level texture index). For example, if... If the corrected texture index value is 23, and the query result is deltaQpMap[2]=-2, then the target encoded quantization value Qp=23+(-2)=21; if the corrected texture index value is 6, and the query result is deltaQpMap[6]=+2, then the target encoded quantization value Qp=23+2=25. It should be noted that the above examples are only illustrative and do not limit the specific content.
[0084] The above method establishes a precise mapping relationship between texture index values and quantization values, making the allocation of quantization values compatible with image texture features: flat areas (small texture index values) have reduced quantization intensity, improving subjective quality with a small number of quantization bits; complex texture areas (large texture index values) have increased quantization intensity, saving quantization bits without affecting subjective effect, thus achieving a balance between subjective quality and bit rate.
[0085] As a feasible approach, Figure 12 This is a schematic flowchart of an image processing method provided in an embodiment of the present disclosure, as shown below. Figure 12 The diagram illustrates the complete image processing logic flow of this scheme. It receives the image to be processed and divides it into pixel image blocks. Sub-pixel image blocks are obtained through downsampling and further divided into sub-pixel regions. The mean brightness, first deviation value, and texture value are calculated. The mean first target texture value and second deviation value are calculated. Combined with a preset protection threshold and texture compensation value, the target texture value for each pixel image block is determined. The mean second target texture value is calculated, and the target index threshold range is divided to determine the texture index value. After correction with a correction value, the corrected texture index value is obtained. The quantization adjustment value is queried, and the target encoded quantization value is calculated in conjunction with the basic quantization value.
[0086] Corresponding to the image processing method described above, the present invention also proposes an image processing apparatus. Since the apparatus embodiments of the present invention correspond to the method embodiments described above, details not disclosed in the apparatus embodiments can be referred to in the method embodiments described above, and will not be repeated here.
[0087] Figure 13 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of the present disclosure, as shown below. Figure 13 As shown, it includes: a processing unit 51, a first determining unit 52, a second determining unit 53, a third determining unit 54, and a matching unit 55.
[0088] Processing unit 51 is used to divide the image to be processed into at least one pixel image block, and process each pixel image block in turn to obtain at least one sub-pixel region corresponding to each pixel image block. The first determining unit 52 is used to determine the target texture value of each pixel image block based on the brightness information of each sub-pixel region. The second determining unit 53 is used to determine the texture index value of each pixel image block based on the target texture value; The third determining unit 54 is used to determine the correction value of each pixel image block by combining the correction result of the texture index value; The matching unit 55 is used to match the corresponding target coded quantization value from the preset coded quantization table in combination with the correction value, so as to optimize the image to be processed.
[0089] In summary, the image processing apparatus of this disclosure includes: dividing the image to be processed into at least one pixel image block; sequentially processing each pixel image block to obtain at least one corresponding sub-pixel region; determining the target texture value of each pixel image block based on the brightness information of each sub-pixel region; determining the texture index value of each pixel image block based on the target texture value; and determining the correction value of each pixel image block based on the correction result of the texture index value; matching the corresponding target coded quantization value from a preset coded quantization table based on the correction value to optimize the image to be processed; by determining the target texture value and texture index value based on the pixel image block, and matching the target coded quantization value with the correction value determined by the texture index value, the computational complexity of feature extraction is reduced, while the target coded quantization value conforms to the image content features, thereby optimizing the encoding effect of the image.
[0090] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 14 As shown, the processing unit 51 includes: The first processing module 511 is used to, in response to the received image to be processed, divide the image to be processed into at least one pixel image block, and sequentially sample each pixel image block to obtain at least one sub-pixel image block corresponding to each pixel image block. The segmentation module 512 is used to divide each subpixel image block into at least one subpixel region.
[0091] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 14 As shown, the first determining unit 52 includes: The first determining module 521 is used to determine the average brightness of each sub-pixel region based on all sub-pixel regions in each sub-pixel image block; The second determining module 522 is used to determine the first deviation value corresponding to each sub-pixel region based on the average brightness value and the brightness value of each sub-pixel point in each sub-pixel region. The third determining module 523 is used to determine the target texture value of the pixel image block to which each sub-pixel region belongs based on the first deviation value of each sub-pixel region.
[0092] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 14 As shown, the third determining module 523 includes: The first determining submodule 5231 is used to determine the first target texture mean value corresponding to the subpixel image block based on the texture values of each subpixel region in any subpixel image block; wherein, the texture value of the subpixel region is determined by each subpixel point contained in the subpixel region; The second determining submodule 5232 is used to determine the second deviation value of the subpixel region based on the first target texture mean and the first deviation value; The judgment submodule 5233 is used to determine whether the second deviation value is greater than or equal to a preset protection threshold. The adjustment submodule 5234 is used to adjust the texture value of the target pixel image block to which any sub-pixel image block belongs according to a preset texture compensation value when it is determined that the second deviation value is greater than or equal to the preset protection threshold, so as to obtain the target texture value of the target pixel image block; The third determining submodule 5235 is used to determine the texture value of any subpixel image block as the target texture value of the target pixel image block when the second deviation value is determined to be less than the preset protection threshold.
[0093] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 14 As shown, the second determining unit 53 includes: The fourth determining module 531 is used to determine the second target texture mean value corresponding to the image to be processed based on the target texture value of each pixel image block in the image to be processed; The fifth determining module 532 is used to determine the target index threshold range of each pixel image block based on the mean value of the second target texture; The sixth determining module 533 is used to determine the texture index value corresponding to the target index threshold range of the target texture value according to the predefined mapping relationship between texture index value and index threshold range.
[0094] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 14 As shown, the third determining unit 54 includes: The seventh determining module 541 is used to determine the average texture index value corresponding to the image to be processed based on the texture index value of each pixel image block; The eighth determining module 542 is used to determine the correction value corresponding to the average texture index based on the average texture index and the preset texture index threshold.
[0095] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 14 As shown, the matching unit 55 includes: The second processing module 551 is used to perform correction processing on each pixel image block based on the correction value to obtain the corrected texture index value. The query module 552 is used to query the preset encoding quantization table to obtain the quantization adjustment value corresponding to the corrected texture index value based on the corrected texture index value; The ninth determining module 553 is used to determine the target encoded quantization value of the image to be processed based on the quantization adjustment value.
[0096] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of the embodiments of this disclosure, and the principle is the same. Therefore, the embodiments of this disclosure are not limited thereto.
[0097] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0098] Figure 15 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as security cameras, surveillance cameras, edge boxes, laptop computers, desktop computers, workstations, personal digital assistants, and servers. 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 claimed herein.
[0099] like Figure 15As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 602 or loaded from storage unit 608 into RAM (Random Access Memory) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.
[0100] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0101] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as image processing methods. For example, in some embodiments, the image processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the aforementioned image processing method by any other suitable means (e.g., by means of firmware).
[0102] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0103] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0104] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0105] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0106] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0107] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0108] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0109] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0110] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An image processing method, characterized by, The method includes: The image to be processed is divided into at least one pixel image block. Each pixel image block is processed sequentially to obtain at least one sub-pixel region corresponding to it. The target texture value of each pixel image block is determined based on the brightness information of each sub-pixel region. The texture index value of each pixel image block is determined based on the target texture value, and the correction value of each pixel image block is determined by combining the correction result of the texture index value. The corrected value is used to match the corresponding target coded quantization value from a preset coded quantization table to optimize the image to be processed.
2. The method according to claim 1, characterized in that, The step of dividing the image to be processed into at least one pixel image block, and processing each pixel image block sequentially to obtain at least one corresponding sub-pixel region, includes: In response to the received image to be processed, the image to be processed is divided into at least one pixel image block, and each pixel image block is sampled sequentially to obtain at least one sub-pixel image block corresponding to each pixel image block. Each subpixel image block is divided into at least one subpixel region.
3. The method according to claim 2, characterized in that, Determining the target texture value of each pixel image block based on the brightness information of each sub-pixel region includes: The average brightness of each sub-pixel region is determined based on all sub-pixel regions in each sub-pixel image block. The first deviation value corresponding to each sub-pixel region is determined based on the average brightness value and the brightness value of each sub-pixel point in each sub-pixel region. The target texture value of the pixel image block to which each sub-pixel region belongs is determined based on the first deviation value of each sub-pixel region.
4. The method according to claim 3, characterized in that, Determining the target texture value of the pixel image block to which each sub-pixel region belongs based on the first deviation value of each sub-pixel region includes: The first target texture mean value corresponding to the sub-pixel image block is determined based on the texture values of each sub-pixel region in any sub-pixel image block; wherein, the texture value of the sub-pixel region is determined by each sub-pixel point contained in the sub-pixel region; A second deviation value for the sub-pixel region is determined based on the mean value of the first target texture and the first deviation value. Determine whether the second deviation value is greater than or equal to the preset protection threshold; If the second deviation value is determined to be greater than or equal to the preset protection threshold, the texture value of the target pixel image block to which any sub-pixel image block belongs is adjusted according to the preset texture compensation value to obtain the target texture value of the target pixel image block; If the second deviation value is determined to be less than the preset protection threshold, the texture value of any sub-pixel image block is determined as the target texture value of the target pixel image block.
5. The method according to claim 1, characterized in that, Determining the texture index value of each pixel image block based on the target texture value includes: The second target texture mean value corresponding to the image to be processed is determined based on the target texture value of each pixel image block in the image to be processed; The target index threshold range of each pixel image block is determined based on the mean value of the second target texture. Based on the predefined mapping relationship between texture index values and index threshold ranges, the texture index value corresponding to the target texture value within the target index threshold range is determined.
6. The method according to claim 1, characterized in that, The step of determining the correction value for each pixel image block by combining the correction result of the texture index value includes: The average texture index of the image to be processed is determined based on the texture index value of each pixel image block; The correction value corresponding to the mean texture index is determined based on the mean texture index and the preset texture index threshold.
7. The method according to claim 6, characterized in that, The step of matching the corresponding target coded quantization value from a preset coded quantization table with the correction value to optimize the image to be processed includes: Based on the correction value, each pixel image block is corrected to obtain the corrected texture index value; Based on the corrected texture index value, the quantization adjustment value corresponding to the corrected texture index value is obtained from the preset encoding quantization table; Based on the quantization adjustment value, the target coded quantization value of the image to be processed is determined.
8. An image processing apparatus, characterized in that, include: The processing unit is used to divide the image to be processed into at least one pixel image block, and process each pixel image block in turn to obtain at least one sub-pixel region corresponding to each pixel. The first determining unit is used to determine the target texture value of each pixel image block based on the brightness information of each sub-pixel region; The second determining unit is used to determine the texture index value of each pixel image block based on the target texture value; The third determining unit is used to determine the correction value of each pixel image block by combining the correction result of the texture index value; A matching unit is used to match the corresponding target coded quantization value from a preset coded quantization table in combination with the correction value, so as to optimize the image to be processed.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-7.