Image processing device and method, chip and electronic equipment
By acquiring the target pixel signal of continuous pixels in the image, determining the correction index value based on the distribution of transparency values, obtaining correction parameters, and pre-correcting the target pixel signal, the problems of color leakage and precision loss in image processing are solved, achieving efficient color leakage prevention and flexible image processing.
Patent Information
- Application Number
- CN202510885571.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-31
AI Technical Summary
Existing technologies in image processing suffer from color leakage due to incorrect handling of transparency, and the premultiplication transparency method may lead to loss of color accuracy.
By acquiring the target pixel signal of continuous pixels in the image, determining the correction index value based on the distribution of transparency values, obtaining correction parameters, and pre-correcting the target pixel signal, including thresholding and mapping or shifting operations, the correction parameters are stored using a three-dimensional correction lookup table.
It effectively prevents color bleeding and avoids loss of color accuracy, improving the flexibility and reliability of image processing.
Smart Images

Figure CN120876205A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image processing apparatus, method, chip, and electronic device. Background Technology
[0002] Color leakage refers to the phenomenon where, during image blending, blurring, interpolation, or other processes that involve spatial dimension processing of an image, incorrect handling of transparency leads to the erroneous diffusion or blending of colors into other areas or layers.
[0003] To prevent color leakage that may occur when processing images in terms of spatial dimensions, related technologies typically store color values pre-multiplied by transparency directly in the image's color value channels. This provides consistent transparency processing for different layers or regions during image processing, making the image's color values closer to the desired color after processing and reducing color leakage.
[0004] However, the method of premultiplying transparency also has the problem of reducing the range of color values, which leads to a loss of color accuracy. Summary of the Invention
[0005] This application provides an image processing apparatus, method, chip, and electronic device to solve the technical problems existing in the related art. Specifically, it includes the following technical solutions.
[0006] In a first aspect, this application provides an image processing apparatus, comprising an acquisition module, a determination module, a query module, and a processing module: the acquisition module is configured to acquire target pixel signals of a plurality of consecutive pixels in an image, wherein the target pixel signal of any pixel in the plurality of pixels carries at least a target color value and a target transparency value of the pixel; the determination module is configured to determine a correction index value based on the distribution of the target transparency value, wherein the correction index value indicates the leakage risk of the target color value; the query module is configured to acquire correction parameters based on the correction index value; and the processing module is configured to pre-correct the target pixel signals based on the correction parameters.
[0007] In some possible implementations, when determining the correction index value based on the distribution state of the target transparency value, the determining module is configured to: extract the target transparency value carried by the target pixel signal; perform thresholding processing on the target transparency value; obtain the correction index value based on the thresholding processing result, wherein the thresholding processing result indicates the distribution state of the target transparency value.
[0008] In some possible implementations, the determining module is configured to extract the target transparency value carried by the target pixel signal by using a sliding window when extracting the target transparency value carried by the target pixel signal.
[0009] In some possible implementations, when the query module obtains the correction parameter based on the correction index value, it is configured to: obtain a first correction parameter based on the correction index value, wherein the first correction parameter is used to pre-correct the target pixel signal through mapping.
[0010] In some possible implementations, the target color value includes a plurality of target color values that correspond one-to-one with the plurality of pixels, and the pre-correction of the target pixel signal by mapping includes rearranging or selecting the plurality of target color values.
[0011] In some possible implementations, when the query module obtains the correction parameter based on the correction index value, it is configured to: obtain a second correction parameter based on the correction index value, the second correction parameter being used to pre-correct the target pixel signal by shifting.
[0012] In some possible implementations, the correction parameters are stored in a correction lookup table, which is a three-dimensional array with a structure of M×N×2. N Wherein, M indicates the number of sub-lookup tables corresponding to the color value and the target transparency value, N indicates the data dimension of the sub-lookup table, and the data dimension corresponds one-to-one with the plurality of pixels, the 2 N Indicates the data depth of the sub-lookup table, the data depth corresponding to the correction index value.
[0013] In some possible implementations, the processing module is further configured to perform image blending, image blurring, and / or image interpolation operations on the corrected image after pre-correcting the target pixel signal to obtain a corrected image.
[0014] Secondly, this application provides an image processing method, the method comprising: acquiring target pixel signals of a plurality of consecutive pixels in an image, wherein the target pixel signal of any pixel in the plurality of pixels carries at least a target color value and a target transparency value of the pixel; determining a correction index value based on the distribution state of the target transparency value, wherein the correction index value indicates the leakage risk of the target color value; acquiring correction parameters based on the correction index value; and pre-correcting the target pixel signals based on the correction parameters.
[0015] In some possible implementations, determining the correction index value based on the distribution state of the target transparency value includes: extracting the target transparency value carried by the target pixel signal; performing thresholding processing on the target transparency value; obtaining the correction index value based on the thresholding processing result, wherein the thresholding processing result indicates the distribution state of the target transparency value.
[0016] In some possible implementations, extracting the target transparency value carried by the target pixel signal includes: extracting the target transparency value carried by the target pixel signal through a sliding window.
[0017] In some possible implementations, obtaining the correction parameter based on the correction index value includes: obtaining a first correction parameter based on the correction index value, wherein the first correction parameter is used to pre-correct the target pixel signal through mapping.
[0018] In some possible implementations, the target color value includes a plurality of target color values that correspond one-to-one with the plurality of pixels, and the pre-correction of the target pixel signal by mapping includes rearranging or selecting the plurality of target color values.
[0019] In some possible implementations, obtaining the correction parameters based on the correction index value includes:
[0020] A second correction parameter is obtained based on the correction index value. The second correction parameter is used to pre-correct the target pixel signal by shifting.
[0021] In some possible implementations, the correction parameters are stored in a correction lookup table, which is a three-dimensional array with a structure of M×N×2. N Wherein, M indicates the number of sub-lookup tables corresponding to the color value and the target transparency value, N indicates the data dimension of the sub-lookup table, and the data dimension corresponds one-to-one with the plurality of pixels, the 2 N Indicates the data depth of the sub-lookup table, the data depth corresponding to the correction index value.
[0022] In some possible implementations, the method further includes: after pre-correcting the target pixel signal to obtain a corrected image, performing image blending, image blurring, and / or image interpolation operations on the corrected image.
[0023] Thirdly, this application provides an electronic device, comprising: a memory storing program instructions for processing images; and a processor, wherein when the program instructions are executed by the processor, the electronic device performs the method described in any one of the second aspects of this application.
[0024] Fourthly, this application provides a computer-readable storage medium having stored thereon program instructions for processing images, which, when executed by one or more processors, cause the processors to implement the method described in any one of the second aspects of this application.
[0025] Fifthly, this application provides a computer program product comprising a computer program that is executed by a processor to enable a computer to perform the method described in any of the second aspects.
[0026] Sixthly, this application provides a chip that includes the image processing apparatus described in any one of the first aspects above.
[0027] The beneficial effects of the technical solution provided in this application include at least the following:
[0028] The technical solution provided in this application, on the one hand, after acquiring the target pixel signals of multiple consecutive pixels and determining the transparency distribution of the multiple pixels based on the target transparency value carried by the target pixel signals, can predict the risk of color leakage in the image area corresponding to the multiple pixels based on the transparency distribution of the multiple pixels. Then, based on the correction index value corresponding to different transparency distribution states, the corresponding correction parameters are obtained to pre-correct the possible color leakage phenomenon in the image. This not only avoids color leakage in advance but also has high flexibility and reliability. On the other hand, before performing targeted correction on the target pixel signal through the correction index parameters, there is no need to change the target color value of the target pixel signal, and there is no loss of color accuracy. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is an implementation scenario diagram provided in the embodiments of this application;
[0031] Figure 2 This is a flowchart of the image processing method provided in the embodiments of this application;
[0032] Figure 3 This is a schematic diagram of the pixel signal of any pixel in an image provided in an embodiment of this application;
[0033] Figure 4This is a schematic diagram illustrating the extraction of target transparency values based on input pixel signals, provided in an embodiment of this application.
[0034] Figure 5 This is a schematic diagram of the structure of the correction lookup table provided in the embodiments of this application;
[0035] Figure 6 This is a schematic diagram of the structure of the image processing apparatus provided in the embodiments of this application;
[0036] Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0037] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0038] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0039] Image transparency is a crucial attribute. In scenarios involving spatial image processing, such as image blending, discontinuous transparency can cause blending algorithms to fail to properly handle color transitions, preventing foreground colors from correctly spreading into the background, resulting in color bleeding. Related techniques often pre-multiply the image's color values by a transparency value to improve the consistency of transparency processing across different layers or regions, reducing color bleeding. However, this method also has the potential for loss of color precision and gradient loss. For example, when the color value ranges from 0 to 255 and the transparency value ranges from 0 to 1, a small transparency value will significantly reduce the range of color values after pre-multiplication, affecting the accuracy of color representation.
[0040] To address the aforementioned technical problems, this application provides an image processing apparatus, method, and electronic device that can predict potential color bleeding based on the distribution of transparency in an image, and then pre-correct the image according to pre-configured correction parameters. This effectively prevents color bleeding while avoiding issues such as loss of color accuracy or drop in color levels.
[0041] Figure 1 This is an implementation scenario diagram provided in the embodiments of this application. (Reference) Figure 1 The implementation scenario provided in this application includes an image acquisition unit 11 and an image processing unit 12.
[0042] The image acquisition unit 11 can be used, but is not limited to, to capture image data. The image processing unit 12 can transmit data with the image acquisition unit 11, enabling the image processing unit 12 to process the image data captured by the image acquisition unit 11. The data transmission between the image processing unit 12 and the image acquisition unit 11 can be achieved through a hardware port connection, such as a USB interface, or through a communication connection, such as WiFi (wireless fidelity) communication or cellular network communication.
[0043] Optionally, the image acquisition unit 11 may be any imaging device such as a camera, image sensor, or scanner, and the image processing unit 12 may be a GPU (graphics processing unit), FPGA (field-programmable gate array), DSP (digital signal processor), ASIC (application-specific integrated circuit), or any other device capable of processing images. This application makes no restrictions in this regard.
[0044] Figure 2 This is a flowchart of an image processing method provided in an embodiment of this application. The method provided in this embodiment can be... Figure 1 The image processing unit shown performs the operation, and this application makes no limitations in this regard. (Reference) Figure 2 The image processing method provided in this application includes the following steps S210-S240.
[0045] Step S210: Obtain the target pixel signal of multiple consecutive pixels in the image. The target pixel signal of any pixel in the multiple pixels carries at least the target color value and the target transparency value of any pixel.
[0046] For example, an image is a set of n pixels, and the target pixel signal is the pixel signal corresponding to the target pixel to be corrected among the n pixels. The target pixels are, for example, any number of consecutive pixels among the n pixels. The pixel signal is, for example, a data stream including multiple data channels, each of which can carry data indicating the attribute information of the pixel. Here, n is an integer greater than 1. The attribute information of the pixel includes at least color and transparency. The data indicating the attribute information of the pixel includes, for example, a color value and a transparency value. The color value indicates the color attribute of the pixel, and the transparency value indicates the transparency attribute of the pixel. The number of data channels determines the data structure of the pixel signal, and the type of data channels determines the attribute information of the pixel.
[0047] For example, the data channels include: a first data channel carrying the color value of any pixel and a second data channel carrying the transparency value of any pixel. The number of the first data channel / second data channel can be one or more, and this application makes no limitation in this regard. In this case, the data structure of the pixel signal is, for example, a one-dimensional array composed of color values and transparency values, where the number of elements in the one-dimensional array is the sum of the number of the first data channel and the number of the second data channel. The attribute information of the pixel includes a color value describing the color and a transparency value describing the transparency.
[0048] Figure 3 This is a schematic diagram of the pixel signal of any pixel point in an image provided in an embodiment of this application.
[0049] refer to Figure 3 The image is a set of pixels P1, P2, P3, P4, ..., Pn, and the pixel signals of the pixels are data streams including a first data channel and a second data channel. The first data channel has 3 channels, and the second data channel has 1 channel.
[0050] In some embodiments, the color value of a pixel includes a red component, a green component, and a blue component. The first data channel includes a data channel R for carrying the red component, a data channel G for carrying the green component, and a data channel B for carrying the blue component. The second data channel is a data channel A for carrying the transparency value of the pixel. In this case, the pixel signal is represented as: P = (R, G, B, A).
[0051] It should be noted that, Figure 3The types and numbers of data channels shown are illustrative and not limiting. In some other embodiments, the color value of a pixel can also be represented by grayscale value, or by hue value, saturation value and brightness value. The number of the first data channels can be adjusted according to the way the color value is represented. Similarly, the transparency value can include multiple components, and the number of the second data channels can be adjusted according to the way the transparency value is represented. This application does not impose any limitations in this regard.
[0052] As mentioned earlier, a target pixel is, for example, any number of consecutive pixels in an image. The number of target pixels is greater than 1 and less than or equal to the number of pixels in the image. For example, when the number of pixels in the image is n, the range of the number of target pixels m is 1 < m ≤ n. The target pixel signal is the pixel signal corresponding to the target pixel, and can be used, but is not limited to, to carry the target pixel's target color value and target transparency value. The target pixel signal has the same representation as the pixel signal of any pixel in the image, which can be referred to... Figure 3 The details and related explanations will not be elaborated here.
[0053] Step S220: Determine the correction index value based on the distribution of the target transparency value. The correction index value indicates the risk of leakage of the target color value.
[0054] Schematic, the target transparency value and target color value are the transparency and color values of the target pixel, carried by the target pixel signal. The distribution of the target transparency value can be used, but is not limited to, indicating the mode of change and distribution of the transparency of the target pixel, that is, the mode of change and distribution of the transparency of the region corresponding to the target pixel in the image. As mentioned above, when processing the spatial dimension of an image, if the transparency of the image is discontinuous, it will lead to color leakage. In view of this, the embodiments of this application can examine the mode of change and distribution of the image's transparency to predict the potential risk of color leakage. By using different correction index values corresponding to different distribution states of the target transparency value, and thus corresponding to the potential risk of color leakage under different distribution states, the pixel signal of the image can be processed in a targeted manner according to the correction index value.
[0055] In some embodiments, a method for determining a correction index value based on the distribution of target transparency values carried by a target pixel signal includes: extracting target transparency values from the target pixel signal; and obtaining a correction index value based on a thresholding processing result, wherein the thresholding processing result indicates the distribution of target transparency values.
[0056] One method for extracting target transparency values from target pixel signals is, for example, using a sliding window to extract the target transparency values carried by the target pixel signals. The process of extracting target pixel signals using a sliding window includes, for example, moving the sliding window within the pixel signals of the image input at a fixed step size, and processing the elements within the window after each movement to obtain one or more target transparency values. The width, height, and step size of the sliding window can be adjusted according to the actual application scenario, and this application does not impose any limitations in this regard.
[0057] The process of thresholding the target transparency value and obtaining the correction index value based on the thresholding result includes, for example, determining a dynamic threshold based on multiple target transparency values of multiple target pixels, and determining the correction index value based on the distribution of multiple target transparency values around the dynamic threshold. The dynamic threshold is related to the target transparency value, and may be, for example, the average or median value of multiple target transparency values. The number of dynamic thresholds can be one or more, and this application does not impose any restrictions in this regard.
[0058] In some embodiments, the number of dynamic thresholds is 1 and the number of target pixels is 4. The process of determining the correction index value based on the distribution of multiple target transparency values around the dynamic threshold is as follows: assign a count bit to the target transparency value of each of the 4 target pixels. If the target transparency value is greater than or equal to the dynamic threshold, mark its corresponding count bit as 1. If the target transparency value is less than the dynamic threshold, mark its count bit as 0. In this case, the distribution of the target transparency value of the target pixel includes the following 16 states: state 0, (0000), state 1, (1000), state 2, (0100), state 3, (0010), state 4, (0001), state 5, (1100), state 6, (1010), state 7, (1001), state 8, (0011), state 9, (0110), state 10, (0101), state 11, (1110), state 12, (0111), state 13, (1011), state 14, (1101), state 15, (1111).
[0059] The following will be based on Figure 3 Taking the pixel signal shown as an example, the operations mentioned above—extracting the target transparency value carried by the target pixel signal, thresholding the target transparency value, and determining the correction index value based on the thresholding result—will be explained. When the data carrying the pixel signal that indicates the attribute information of the pixel changes, the principle of the above operations remains the same and will not be elaborated further.
[0060] Figure 4 This is a schematic diagram illustrating the extraction of target transparency values based on input pixel signals, provided in an embodiment of this application.
[0061] In some embodiments, the color value of any pixel in an image includes a red component, a green component, and a blue component.
[0062] like Figure 4 As shown, when the pixel signal is a data stream comprising four data channels, and the data channels of the pixel signal are respectively a data channel R for carrying the red component, a data channel G for carrying the green component, a data channel B for carrying the blue component, and a data channel A for carrying the pixel's transparency value, the pixel signal is, for example, a one-dimensional array comprising four elements, represented as: P = (R, G, B, A). The pixel signal input to the image is, for example, a matrix of n elements, where each element corresponds to a one-dimensional array of pixel signals. The image input signal is represented as: {(R1, G1, B1, A), (R2, G2, B2, A2), (R3, G3, B3, A3), (R4, G4, B4, A4), ..., (Rn, Gn, Bn, An)}.
[0063] Wherein, P1, P2, P3, and P4 are any four consecutive pixels out of n pixels in the image, which are the target pixels to be corrected, and the pixel signal corresponding to the target pixel is the target pixel signal. As shown in the figure, the pixel signals of the four target pixels together form a 1×4 matrix: {(R1, G1, B1, A1), (R2, G2, B2, A2), (R3, G3, B3, A3), (R4, G4, B4, A4)}, and each element of the matrix is a 1×4 array, namely: (R1, G2, B3, A4), (R2, G2, B2, A2), (R3, G3, B3, A3), (R4, G4, B4, A4).
[0064] Based on this, the target pixel signal is extracted and processed through a sliding window. The output target transparency value is, for example, an array formed by the transparency values of the four target pixels. The array is represented as (A1, A2, A3, A4).
[0065] In some embodiments, the width and height of the sliding window are equal to the width and height of the data carried by the target pixel signal. After each movement, the sliding window can simultaneously extract the target transparency values of multiple target pixels, so that it can directly output the target transparency values of multiple target pixels after each movement. For example, when the target pixel signal of the target pixel is represented as {(R1, G1, B1, A1), (R2, G2, B2, A2), (R3, G3, B3, A3), (R4, G4, B4, A4)}, the sliding window is represented as {(0, 0, 0, 1), (0, 0, 0, 1), (0, 0, 0, 1), (0, 0, 0, 1)}, and the output of the sliding window after each movement is (A1, A2, A3, A4).
[0066] In some embodiments, the width and height of the sliding window may not be equal to the width and height of the data carried by the target pixel signal. After each movement, the sliding window can extract the target transparency value of one or more target pixels from a plurality of target pixels, so that the sliding window can determine the target transparency value of multiple target pixels based on the output after multiple movements. For example, when the target pixel signal of the target pixels is represented as {(R1, G1, B1, A1), (R2, G2, B2, A2), (R3, G3, B3, A3), (R4, G4, B4, A4)}, the sliding window is represented as {(0, 0, 0, 1)}. After each movement, the sliding window can only extract the target transparency value of one target pixel from a plurality of target pixels, and can determine the target transparency values of four target pixels (A1, A2, A3, A4) based on the output after four movements.
[0067] It should be noted that, Figure 4 The number of target pixels shown is illustrative and not limiting. In other embodiments, the number of target pixels may be more or less, and this application makes no limitation in this regard.
[0068] Step S230: Obtain the correction parameters based on the correction index value.
[0069] For example, the correction parameters are not fixed and can be configured according to the desired image processing effect and the pixel signal of the input image. The correction parameters also vary depending on the actual application scenario. As mentioned above, the correction index value can be used to indicate the risk of leakage of the target color value corresponding to different distribution states of the target transparency value. Based on this, since the pixel signals of different images are different, the distribution states of the transparency values of the corresponding pixels are also different. The method provided in this application embodiment can pre-configure the correction parameters according to the input pixel signal and the desired image processing effect, and index different distribution states of the target transparency value to the corresponding correction parameters through the correction index value. This allows the solution provided in this application to perform targeted processing of the pixel signal of the input image according to actual needs, reducing color leakage.
[0070] In some embodiments, the correction parameters are stored in a correction lookup table, which is a three-dimensional array with a structure of M×N×2. N Where M indicates the number of sub-lookup tables corresponding to the color value and the target transparency value, and N indicates the data dimension of the sub-lookup table, with each data dimension corresponding one-to-one with multiple pixels. N The data depth of the sub-lookup table is indicated, and the data depth corresponds one-to-one with the correction index value.
[0071] Figure 5 This is a schematic diagram of the structure of the correction lookup table provided in an embodiment of this application. The following will be combined with... Figure 5 The correction lookup table provided in the embodiments of this application will be further explained.
[0072] If the pixel signal of a pixel is a data stream containing multiple data channels, the multiple data channels are: data channel R for carrying the red component, data channel G for carrying the green component, data channel B for carrying the blue component, and data channel A for carrying the pixel transparency value. That is, the number of data channels of the pixel signal is 4, the number of target pixels is 4, the number of dynamic thresholds is 1, and the distribution state of the target transparency value includes 16 states, namely: state 0, (0000), state 1, (1000), state 2, (0100), state 3, (0010), state 4, (0001), state 5, (1100), state 6, (1010), state 7, (1001), state 8, (0011), state 9, (0110), state 10, (0101), state 11, (1110), state 12, (0111), state 13, (1011), state 14, (1101), state 15, (1111).
[0073] In this case, the correction lookup table has a structure of 4×4×2. 4The three-dimensional array, the specific meaning of the structure of the correction lookup table is as follows: the correction lookup table includes four sub-lookup tables corresponding to 3 color value components and 1 transparency value. Each sub-lookup table includes 4 data dimensions corresponding to 4 target pixels. The data depth of each sub-lookup table corresponds to 16 distribution states, that is, 16 correction index values.
[0074] Considering that different correction requirements may exist simultaneously when correcting pixel signals of an image in real-world applications, multiple correction lookup tables can be configured to meet these diverse needs.
[0075] For example, the correction lookup table includes a first correction lookup table, and the correction parameters include a first correction parameter obtained from the first correction lookup table. Obtaining the correction parameter according to the correction index value includes: obtaining the first correction parameter according to the correction index value, whereby the first correction parameter is used to pre-correct the target pixel signal through mapping. The mapping is used to directly map the data of the input pixel signal to a pre-configured output value, and can be used, but is not limited to, pre-correcting the color values in the pixel signal.
[0076] In some embodiments, mapping includes rearranging or selecting a plurality of target color values, each target color value corresponding one-to-one with a plurality of target pixels. In this case, pre-correcting the target pixel signal by mapping includes rearranging or selecting the plurality of target color values.
[0077] The following will combine Figure 4 and Figure 5 The principle of pre-correction through mapping described above will be explained.
[0078] like Figure 4 As shown, the color values corresponding to the data channels R of the four target pixels are (R1, R2, R3, R4). In some embodiments, the color values corresponding to the data channels R of the four target pixels can be numbered according to their positions, for example: the position number of R1 is 00, the position number of R2 is 01, the position number of R3 is 11, and the position number of R4 is 10.
[0079] For example Figure 5The correction parameters for data channel R corresponding to state 11 are 00, 01, 11, and 00. In this case, the first correction parameter can map the color values (R1, R2, R3, R4) corresponding to the data channel R of the input target pixel to (R1, R2, R3, R1), that is, the color values corresponding to the four data channels R are reselected. It should be noted that the principle of pre-correcting pixels according to the correction parameters is the same in different application scenarios. The explanation of mapping here can also be applied to image pre-correction in other scenarios, which will not be repeated below.
[0080] In some embodiments, the correction lookup table includes a second correction lookup table, and the correction parameters include second correction parameters obtained from the second correction lookup table. Obtaining the correction parameters according to the correction index value includes: obtaining the second correction parameters according to the correction index value, whereby the second correction parameters are used to pre-correct the target pixel signal by shifting. Shifting is used to numerically adjust the data carried by the input pixel signal through multiplication or division operations. For example, in binary data representation, shifting is, for instance, shifting the value one bit to the left, which means dividing the corresponding value by 2 (rounding down). Pre-correcting the pixel signal by shifting can be used, but is not limited to, pre-correcting jagged edges that may appear in the image.
[0081] Step S240: Pre-correct the target pixel signal according to the correction parameters.
[0082] As mentioned above, pre-correction of the target pixel signal based on correction parameters includes, but is not limited to, rearranging or selecting the target color values carried by the target pixel signal, or performing AND correction on the target pixel signal through shifting. As also mentioned above, the target pixel signal is any number of consecutive pixels among n pixels in the image, and the correction parameters can be configured according to the desired image processing effect and the input pixel signal. Based on this, embodiments of this application can configure different correction parameters for target pixel signals in different regions of the image, enabling targeted processing of different regions of the image to improve image quality; alternatively, the same correction parameters can be configured for target pixel signals in different regions of the image, reducing the pressure on computing resources and storage space during image processing and ensuring processing speed and efficiency. In other words, the method provided by embodiments of this application can flexibly configure correction parameters to meet different image processing needs depending on the application scenario, and has broad adaptability to different application scenarios.
[0083] In some embodiments, the method provided in this application further includes: after pre-correcting the target pixel signal to obtain a corrected image, performing image blending, image blurring, and / or image interpolation operations on the corrected image. The corrected image is used to indicate the image obtained after performing correction processing on the target pixel signal in the image according to correction parameters. Performing image blending, image blurring, and / or image interpolation operations on the corrected image can be, for example, performing image blending on the corrected image, or performing image blurring on the corrected image, or performing image interpolation on the corrected image, or performing both image blending and image blurring on the corrected image, or performing both image blending and image interpolation on the corrected image; this application does not impose any limitations in this regard.
[0084] For example, image blending operation is used to instruct the mixing of attribute information of corresponding pixels in multiple images according to certain rules to generate a single image. Image blurring operation is used to instruct the adjustment of attribute information of one or more pixels in an image to reduce image sharpness. Image interpolation operation is used to instruct the estimation of attribute information of unknown pixels using attribute information of known pixels in an image to achieve effects such as image magnification, rotation, and / or deformation. Since the image can be pre-corrected by correction parameters to avoid problems such as color bleeding and loss of accuracy that may occur during image processing, the method provided in this application embodiment can obtain a high-quality image after performing image blending, image blurring, and / or image interpolation operations on the image.
[0085] The image processing apparatus, method, and electronic device provided in this application, on the one hand, after acquiring target pixel signals of multiple consecutive pixels and determining the transparency distribution of the multiple pixels based on the target transparency value carried by the target pixel signals, can predict the risk of color bleeding in the image area corresponding to the multiple pixels based on the transparency distribution of the multiple pixels. Then, based on the correction index value corresponding to different transparency distribution states, the corresponding correction parameters are obtained to pre-correct the possible color bleeding phenomenon in the image. This not only avoids color bleeding in advance but also has high flexibility and reliability. On the other hand, before performing targeted correction on the target pixel signal through the correction index parameter, there is no need to change the target color value of the target pixel signal, and there is no loss of color accuracy.
[0086] In another possible implementation, this application provides an image processing apparatus. Figure 6 This is a schematic diagram of the image processing apparatus provided in an embodiment of this application. See also... Figure 6The image processing apparatus provided in this application includes an acquisition module 610, a determination module 620, a query module 630, and a processing module 640.
[0087] The acquisition module 610 is configured to acquire target pixel signals of a plurality of consecutive pixels in an image, wherein the target pixel signal of any pixel carries at least the target color value and the target transparency value of any pixel.
[0088] The determination module 620 is configured to determine a correction index value based on the distribution of the target transparency value, the correction index value indicating the risk of leakage of the target color value.
[0089] Query module 630 is configured to retrieve correction parameters based on the correction index value.
[0090] The processing module 640 is configured to pre-correct the target pixel signal according to the correction parameters.
[0091] In some embodiments, when determining the correction index value based on the distribution state of the target transparency value carried by the target pixel signal, the determining module 620 is configured to: extract the target transparency value carried by the target pixel signal; perform thresholding processing on the target transparency value; obtain the correction index value based on the thresholding processing result; and the thresholding processing result indicates the distribution state of the target transparency value.
[0092] In some embodiments, when extracting the target transparency value carried by the target pixel signal, the determining module 620 is configured to extract the target transparency value carried by the target pixel signal through a sliding window.
[0093] In some embodiments, when the query module 630 obtains the correction parameter based on the correction index value, it is configured to: obtain a first correction parameter based on the correction index value, the first correction parameter being used to pre-correct the target pixel signal through mapping.
[0094] In some embodiments, the target color value includes a plurality of target color values that correspond one-to-one with a plurality of pixels, and pre-correcting the target pixel signal by mapping includes rearranging or selecting the plurality of target color values.
[0095] In some embodiments, when the query module 630 obtains the correction parameter based on the correction index value, it is configured to: obtain a second correction parameter based on the correction index value, the second correction parameter being used to pre-correct the target pixel signal by shifting.
[0096] In some embodiments, the correction parameters are stored in a correction lookup table, which is a three-dimensional array with a structure of M×N×2. NWhere M indicates the number of sub-lookup tables corresponding to the color value and the target transparency value, and N indicates the data dimension of the sub-lookup table, with each data dimension corresponding one-to-one with multiple pixels. N Indicates the data depth of the sub-lookup table, which corresponds to the corrected index value.
[0097] In some embodiments, the processing module 640 is further configured to perform image blending, image blurring, and / or image interpolation operations on the corrected image after pre-correcting the target pixel signal to obtain a corrected image.
[0098] The above Figure 6 The principle of the image processing device shown can be referred to the above. Figure 2 The related descriptions of the above embodiments are omitted here. The image processing apparatus embodiments and image processing method embodiments provided above belong to the same concept, and their specific implementation process can be found in the image processing method.
[0099] In some other possible implementations, this application also provides an electronic device. Figure 7 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. See also... Figure 7 The electronic device provided in this application includes: a memory 710 storing program instructions for processing images; and a processor 720, which, when the program instructions are executed by the processor 720, causes the electronic device to perform the above-mentioned functions. Figure 2 The methods shown in its various embodiments are as follows. Of course, the electronic device may also have wired or wireless network interfaces, keyboards, and input / output interfaces for input and output. The electronic device may also include other components for implementing device functions, which will not be elaborated here.
[0100] In other possible embodiments, this application also provides a computer-readable storage medium storing program instructions for processing images, which, when executed by one or more processors, cause the processors to perform the above-described combination. Figure 2 The steps of the described method and its various embodiments are described. The computer-readable storage medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0101] In other possible embodiments, this application also provides a computer program product comprising a computer program that is executed by a processor to cause the computer to be coupled with Figure 2 The steps of the described method and its various embodiments.
[0102] In some other possible implementations, this application also provides a chip, the chip comprising: Figure 6 The image processing device shown.
[0103] It should also be noted that the terms "first," "second," etc. (if applicable) in the specification and claims of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0104] The term "and / or" in the embodiments of this application is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B currently exist, and B exists alone.
[0105] The above description is only for the purpose of enabling those skilled in the art to understand the technical solution of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application shall be included within the scope of protection of this application.
Claims
1. An image processing apparatus, characterized in that, The device includes an acquisition module, a determination module, a query module, and a processing module: The acquisition module is configured to acquire target pixel signals of a plurality of consecutive pixels in an image, wherein the target pixel signal of any pixel in the plurality of pixels carries at least the target color value and the target transparency value of the pixel. The determining module is configured to determine a correction index value based on the distribution of the target transparency value, the correction index value indicating the risk of leakage of the target color value; The query module is configured to obtain correction parameters based on the correction index value; The processing module is configured to pre-correct the target pixel signal according to the correction parameters.
2. The apparatus according to claim 1, characterized in that, When determining the correction index value based on the distribution of the target transparency value, the determining module is configured as follows: Extract the target transparency value carried by the target pixel signal; The target transparency value is thresholded, and the correction index value is obtained based on the thresholding result. The thresholding result indicates the distribution state of the target transparency value.
3. The apparatus according to claim 2, characterized in that, When the determining module extracts the target transparency value carried by the target pixel signal, it is configured to: The target transparency value carried by the target pixel signal is extracted using a sliding window.
4. The apparatus according to claim 1, characterized in that, When the query module obtains the correction parameters based on the correction index value, it is configured as follows: A first correction parameter is obtained based on the correction index value, and the first correction parameter is used to pre-correct the target pixel signal through mapping.
5. The apparatus according to claim 4, characterized in that, The target color value includes multiple target color values that correspond one-to-one with the multiple pixels, and the pre-correction of the target pixel signal by mapping includes rearranging or selecting the multiple target color values.
6. The apparatus according to claim 1, characterized in that, When the query module obtains the correction parameters based on the correction index value, it is configured as follows: A second correction parameter is obtained based on the correction index value. The second correction parameter is used to pre-correct the target pixel signal by shifting.
7. The apparatus according to any one of claims 1-6, characterized in that, The correction parameters are stored in a correction lookup table, which is a three-dimensional array with an M×N×2 structure. N ; Wherein, M indicates the number of sub-lookup tables corresponding to the color value and the target transparency value, N indicates the data dimension of the sub-lookup table, and the data dimension corresponds one-to-one with the plurality of pixels, the 2 N Indicates the data depth of the sub-lookup table, the data depth corresponding to the correction index value.
8. The apparatus according to claim 1, characterized in that, The processing module is further configured to perform image blending, image blurring, and / or image interpolation operations on the corrected image after pre-correcting the target pixel signal to obtain a corrected image.
9. An image processing method, characterized in that, The method includes: Acquire target pixel signals of multiple consecutive pixels in an image, wherein the target pixel signal of any pixel in the multiple pixels carries at least the target color value and the target transparency value of that pixel; A correction index value is determined based on the distribution of the target transparency value, and the correction index value indicates the risk of leakage of the target color value. Obtain the correction parameters based on the correction index value; The target pixel signal is pre-corrected according to the correction parameters.
10. The method according to claim 9, characterized in that, Determining the correction index value based on the distribution of the target transparency value includes: Extract the target transparency value carried by the target pixel signal; The target transparency value is thresholded, and the correction index value is obtained based on the thresholding result. The thresholding result indicates the distribution state of the target transparency value.
11. The method according to claim 10, characterized in that, The step of extracting the target transparency value carried by the target pixel signal includes: The target transparency value carried by the target pixel signal is extracted using a sliding window.
12. The method according to any one of claims 9-11, characterized in that, The correction parameters are stored in a correction lookup table, which is a three-dimensional array with an M×N×2 structure. N Wherein, M indicates the number of sub-lookup tables corresponding to the color value and the target transparency value, N indicates the data dimension of the sub-lookup table, and the data dimension corresponds one-to-one with the plurality of pixels, the 2 N Indicates the data depth of the sub-lookup table, the data depth corresponding to the correction index value.
13. The method according to any one of claims 9-11, characterized in that, The method further includes: After pre-correcting the target pixel signal to obtain a corrected image, image blending, image blurring, and / or image interpolation operations are performed on the corrected image.
14. A chip, characterized in that, The chip includes the image processing apparatus according to any one of claims 1-8.
15. An electronic device, characterized in that, include: A memory that stores program instructions for processing images; as well as A processor, when the program instructions are executed by the processor, causes the electronic device to perform the method of any one of claims 9-13.