Image processing method and device, electronic equipment, storage medium and program product
By calculating and applying target pixel value adjustment parameters to process the initial image, the problem of high computational complexity in the image mixing process is solved, and the effect of reducing the calculation complexity and image data transmission amount under the conditions of ensuring image mixing quality is achieved.
Patent Information
- Application Number
- CN202411356453.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, the computational complexity in the image mixing process is high, resulting in low image mixing efficiency.
By acquiring the initial image and the image to be mixed, and determining the mixing mode of the image to be mixed, the target pixel value adjustment parameters are calculated, and the initial image is adjusted using these parameters to obtain the target mixed image.
When the number of mixed layers increases, the target pixel value adjustment parameters are pre-calculated to reduce the calculation complexity and image data transmission amount, and improve image mixing efficiency.
Smart Images

Figure CN119450241A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing, and in particular to an image processing method, device, electronic device, storage medium, and program product. Background Art
[0002] With the gradual development of the field of data image processing, in order to obtain higher quality images, images are generally processed through methods such as image blending and layer overlay. It is widely used in special effects rendering, user interface involvement, and digital image creation. Specifically, multiple images are superimposed in different blending modes to enrich the image.
[0003] The image blending and superposition method generally used in the related art is, for example, to superimpose the base map and the multiple layers to be blended according to the layer order based on the blending formula to obtain a new blended image. However, as the number of blending layers increases, the number of calculation steps required in the blending process will also increase accordingly, and the calculation complexity in the image blending process is high, resulting in low image blending efficiency. Summary of the invention
[0004] The present disclosure provides an image processing method, device, electronic device, storage medium and program product to at least solve the problem of low image mixing efficiency in the related art. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an image processing method, including:
[0006] Acquire an initial image and each image to be mixed, and determine a mixing mode corresponding to each of the images to be mixed;
[0007] Based on the images to be mixed and the mixing modes respectively corresponding to the images to be mixed, a target pixel value adjustment parameter is obtained;
[0008] The pixel values of the initial image are adjusted using the target pixel value adjustment parameters to obtain a target mixed image.
[0009] In one embodiment, the mixing mode includes a correspondence between an input pixel value and an output pixel value; and obtaining a target pixel value adjustment parameter based on each of the images to be mixed and the mixing mode corresponding to each of the images to be mixed includes:
[0010] Based on the correspondence between the input pixel values and the output pixel values corresponding to each of the images to be mixed, a target correspondence is obtained, and based on the target correspondence and the pixel values corresponding to each of the images to be mixed, a target pixel value adjustment parameter is determined, wherein the target correspondence represents the correspondence between the input pixel values and the output pixel values after mixing based on each of the mixing modes.
[0011] In one embodiment, the pixel values of each of the images to be mixed are processed based on the correspondence between the input pixel values and the output pixel values corresponding to each of the images to be mixed to obtain the target correspondence, including:
[0012] According to the arrangement order of the images to be mixed, processing is performed based on the correspondence between the input pixel values and the output pixel values corresponding to the images to be mixed, so as to obtain the target correspondence.
[0013] In one embodiment, the mixing modes corresponding to the images to be mixed include different types of mixing modes, or the same type of mixing modes.
[0014] In one embodiment, adjusting the pixel value of the initial image by using the target pixel value adjustment parameter to obtain a target mixed image includes:
[0015] For each pixel in the initial image, based on the target pixel value adjustment parameter and the pixel value of the pixel, determine an adjusted pixel value corresponding to the pixel;
[0016] Based on the adjusted pixel values respectively corresponding to the pixel points, the initial image is adjusted to obtain a target mixed image.
[0017] In one embodiment, the method further comprises:
[0018] The first real-time image is overlaid with the target mixed image to obtain a second real-time image, and the second real-time image is output.
[0019] According to a second aspect of an embodiment of the present disclosure, there is provided an image processing apparatus, including:
[0020] An acquisition unit is configured to acquire an initial image and each image to be mixed, and determine a mixing mode corresponding to each image to be mixed;
[0021] A mixing determination unit is configured to execute based on each of the to-be-mixed images and the mixing modes respectively corresponding to each of the to-be-mixed images to obtain a target pixel value adjustment parameter;
[0022] The adjustment unit is configured to adjust the pixel value of the initial image by using the target pixel value adjustment parameter to obtain a target mixed image.
[0023] In one embodiment, the mixing mode includes a correspondence between input pixel values and output pixel values; and the mixing determination unit includes:
[0024] The first determination subunit is configured to execute a target correspondence relationship based on the correspondence relationship between the input pixel values and the output pixel values corresponding to each of the images to be mixed, and determine a target pixel value adjustment parameter based on the target correspondence relationship and the pixel values corresponding to each of the images to be mixed, wherein the target correspondence relationship represents the correspondence relationship between the input pixel values and the output pixel values after mixing based on each of the mixing modes.
[0025] In one embodiment, the first determining subunit is specifically configured to:
[0026] According to the arrangement order of the images to be mixed, processing is performed based on the correspondence between the input pixel values and the output pixel values corresponding to the images to be mixed, so as to obtain the target correspondence.
[0027] In one embodiment, the mixing modes corresponding to the images to be mixed include different types of mixing modes, or the same type of mixing modes.
[0028] In one embodiment, the adjustment unit comprises:
[0029] A second determining subunit is configured to determine, for each pixel in the initial image, an adjusted pixel value corresponding to the pixel based on the target pixel value adjustment parameter and the pixel value of the pixel;
[0030] The adjustment subunit is configured to adjust the initial image based on the adjusted pixel values corresponding to each of the pixel points to obtain a target mixed image.
[0031] In one embodiment, the apparatus further comprises:
[0032] The output unit is configured to perform superposition processing on the first real-time image through the target mixed image to obtain a second real-time image, and output the second real-time image.
[0033] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0034] processor;
[0035] a memory for storing instructions executable by the processor;
[0036] The processor is configured to execute the instructions to implement the image processing method as described in any one of the first aspects above.
[0037] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform an image processing method as described in any one of the first aspects above.
[0038] According to a seventh aspect of an embodiment of the present disclosure, a computer program product is provided. When the instructions are executed by a processor of an electronic device, the electronic device is enabled to perform the image processing method as described in any one of the first aspects above.
[0039] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0040] The target pixel value adjustment parameters are calculated for the mixing modes corresponding to the images to be mixed; the pixel values of the initial image are adjusted by the target pixel value adjustment parameters to obtain the target mixed image. By adopting this method, the target pixel value adjustment parameters for adjusting the initial image can be calculated in advance when the number of mixing layers increases, and the image data to be transmitted can be reduced while ensuring the quality of image mixing, thereby reducing the calculation complexity.
[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0043] Figure 1 The figure is a flowchart of an image processing method according to an exemplary embodiment.
[0044] Figure 2 The figure is a flowchart of an image processing method according to an exemplary embodiment.
[0045] Figure 3 It is a schematic diagram of an initial image and images to be mixed in an image processing method according to an exemplary embodiment.
[0046] Figure 4 It is a schematic diagram of a target correspondence relationship after mixing images to be mixed corresponding to an initial image in an image processing method according to an exemplary embodiment.
[0047] Figure 5 is a block diagram of an image processing apparatus according to an exemplary embodiment.
[0048] Figure 6It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0049] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0051] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0052] The image processing method provided by the present disclosure can be applied to a terminal, or to a system including a terminal and a server, and can be implemented through the interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented as an independent server or a server cluster consisting of multiple servers.
[0053] Figure 1 is a flowchart of an image processing method according to an exemplary embodiment. Figure 1 As shown, the image processing method is used in a terminal and includes the following steps:
[0054] In step S102, an initial image and images to be mixed are obtained, and a mixing mode corresponding to each image to be mixed is determined.
[0055] Among them, the initial image may be an image that needs to be mixed, for example, it may be a base image or a basic image. The present disclosure does not specifically limit the content of the initial image, for example, it may be a face image, etc.; the image to be mixed may be a picture that adjusts the pixel value of the initial image, for example, it may be a rendering material, etc. Each image to be mixed may correspond to a mixing mode, which refers to the way of processing the pixel values of the current initial image and the pixel values of the image to be mixed when the current initial image is mixed through the image to be mixed; the mixing mode may be a mixing mode of a first-order polynomial, which may include, for example, a multiply mode, a normal mode, a screen mode, an addition mode, a hardlight mode, an exclude mode, etc.
[0056] Specifically, the terminal can obtain an initial image and each image to be mixed. The initial image can be a base image selected by the user that needs to be mixed, and the image to be mixed can be an image selected by the user to perform image mixing on the initial image; the mixing mode of the image to be mixed can be pre-configured, that is, the mixing mode of each image to be mixed is pre-configured, and the mixing mode of the image to be mixed can also be selected in real time, for example, it can be selected for each image to be mixed after the user selects each image to be mixed. The terminal device can respond to the trigger operation of the user's image mixing operation, obtain the initial image corresponding to the trigger operation, and each image to be mixed, and determine the mixing mode corresponding to each image to be mixed; the mixing modes corresponding to each image to be mixed can be the same, or they can be different.
[0057] In step S104, a target pixel value adjustment parameter is obtained based on each to-be-mixed image and the mixing mode corresponding to each to-be-mixed image.
[0058] The target pixel value adjustment parameter may be obtained by processing the mixing modes corresponding to the images to be mixed.
[0059] Specifically, after determining the images to be mixed corresponding to the initial image and the mixing modes corresponding to each image to be mixed, the terminal can perform nested calculations based on the mixing modes of each image to be mixed to obtain a target mixing mode that can characterize the mixing of multiple mixing modes, and process the target mixing mode based on the pixel values of each pixel point of each image to be mixed to obtain the target pixel value adjustment parameters corresponding to each pixel point.
[0060] In step S106, the pixel values of the initial image are adjusted using the target pixel value adjustment parameters to obtain a target mixed image.
[0061] The pixel values of the initial image may be the pixel values of each pixel point in the initial image, and the target mixed image may be an image obtained by mixing the initial image and each image to be mixed.
[0062] Specifically, the terminal can adjust the pixel value of each pixel in the initial image based on the determined target pixel value adjustment parameter to obtain the adjusted pixel value corresponding to each pixel, configure each pixel on the initial image based on the adjusted pixel value corresponding to each pixel, configure the pixel value of each pixel on the initial image to the adjusted pixel value corresponding to each pixel, and obtain the target mixed image based on the adjusted pixel points; in one example, the terminal can determine the configured initial image as the target mixed image.
[0063] Optionally, for each pixel point on the initial image, the pixel value of the pixel point may be, for example, a first pixel value, and the first pixel value of the pixel point is adjusted and calculated based on the target pixel value adjustment parameter, and the obtained pixel value may be a second pixel value. The terminal may configure the pixel point in the initial image to the second pixel value. The terminal may perform the method described in the above embodiment on each pixel point on the initial image to obtain a configured initial image, and determine the configured initial image as the target mixed image.
[0064] In the above image processing method, the target pixel value adjustment parameter is calculated for each mixing mode corresponding to each image to be mixed; the pixel value of the initial image is adjusted by the target pixel value adjustment parameter to obtain the target mixed image. By adopting this method, the target pixel value adjustment parameter for adjusting the initial image can be calculated in advance when the number of mixing layers increases, and the image data to be transmitted can be reduced while ensuring the quality of image mixing, thereby reducing the calculation complexity.
[0065] In an exemplary embodiment, the blending mode includes a correspondence between input pixel values and output pixel values.
[0066] Specifically, the correspondence between the input pixel value and the output pixel value may be that the input pixel value is processed based on the correspondence to obtain the output pixel value. In one example, the terminal may obtain an initial image and a first image to be mixed, and determine the correspondence between the output pixel value corresponding to the first image to be mixed and the input pixel value. In this case, the input pixel value may include the pixel value of the pixel point on the initial image and the pixel value of the pixel point on the first image to be mixed. The terminal may process the pixel value of the pixel point on the initial image and the pixel value of the pixel point on the first image to be mixed based on the correspondence to obtain the output pixel value corresponding to each pixel point.
[0067] In step S104, based on each to-be-mixed image and the mixing mode corresponding to each to-be-mixed image, a target pixel value adjustment parameter is obtained, which can be specifically achieved by the following steps:
[0068] Based on the correspondence between the input pixel values and the output pixel values corresponding to each image to be mixed, a target correspondence is obtained, and based on the target correspondence and the pixel values corresponding to each image to be mixed, a target pixel value adjustment parameter is determined.
[0069] The target correspondence relationship representation is based on the correspondence between the input pixel value and the output pixel value after mixing in each mixing mode; the pixel value corresponding to each image to be mixed is the pixel value of each pixel point on each image to be mixed.
[0070] Specifically, the terminal may first determine the correspondence between the input pixel values and the output pixel values represented by the mixing modes corresponding to the images to be mixed, and mix the correspondence between the input pixel values and the output pixel values represented by the mixing modes to obtain a target correspondence that can represent the correspondence between the input pixel values and the output pixel values after mixing the mixing modes. Based on this, the terminal may replace the input pixel values represented by the target correspondence based on the pixel values of the pixels on the images to be mixed to obtain the target pixel value adjustment parameters.
[0071] In one example, the image to be mixed configured by the user for the initial image may include a first image to be mixed and a second image to be mixed; the mixing mode of the first image to be mixed may include a first correspondence between input pixel values and output pixel values, and the mixing mode of the second image to be mixed may include a second correspondence between input pixel values and output pixel values. The input pixel values corresponding to the first correspondence may include the pixel values of the initial image and the pixel values of the first image to be mixed, and the input pixel values corresponding to the second correspondence may be the output pixel values of the first correspondence. The specific process of the mixing process may be that the terminal performs nested processing on the first correspondence and the second correspondence to obtain the target correspondence.
[0072] Based on the above scheme, multiple images to be mixed and the mixing modes corresponding to each image to be mixed can be pre-mixed to obtain a target correspondence relationship that can characterize the multiple mixing modes after mixing, thereby further reducing the computational complexity.
[0073] In an exemplary embodiment, the step of “processing the pixel values of each image to be mixed based on the correspondence between the input pixel values and the output pixel values corresponding to each image to be mixed to obtain the target correspondence” can be specifically implemented by the following steps:
[0074] According to the arrangement order of each to-be-mixed image, processing is performed based on the correspondence between the input pixel value and the output pixel value corresponding to each to-be-mixed image in turn to obtain a target correspondence.
[0075] Among them, the initial image may correspond to multiple images to be mixed, and the arrangement order of each image to be mixed may be pre-configured by the user, or determined according to the order in which the user selects each image to be mixed, and the order of each image to be mixed selected by the user is used as the arrangement order of each image to be mixed.
[0076] Specifically, in the case where the mixing modes corresponding to the images to be mixed are different, the terminal can determine the arrangement order of the images to be mixed with the initial image when the multiple images to be mixed corresponding to the initial image are determined. The terminal can perform nesting processing on the correspondence between the input pixel values and the output pixel values represented by the images to be mixed in sequence according to the arrangement order to obtain the target correspondence.
[0077] Based on the above scheme, in the case of multiple types of mixing modes, each mixing mode can be mixed in turn to ensure the accuracy of the target pixel value adjustment parameter corresponding to the output target correspondence relationship.
[0078] In an exemplary embodiment, the mixing modes corresponding to the images to be mixed include different types of mixing modes, or the same type of mixing modes.
[0079] Specifically, the blending mode may be a blending mode of a first-order polynomial, and the blending mode may include, for example, a multiply mode, a normal mode, a screen mode, an add mode, a hardlight mode, an exclude mode, and the like. Blending modes of the images to be mixed corresponding to the initial image. In one example, the blending modes corresponding to the multiple images to be mixed for image blending of the initial image may be configured by the user, for example, the blending modes corresponding to the images to be mixed may be the same, for example, they may all be the multiply mode, and the like; in another example, the blending modes corresponding to the images to be mixed may be different, for example, the user may configure the corresponding blending mode for each image to be mixed based on the needs of the actual application scenario.
[0080] Based on the above scheme, the mixing modes corresponding to each image to be mixed can be determined based on the actual application scenario, ensuring the flexibility of selecting the image to be mixed and determining the mixing modes corresponding to each image to be mixed, thereby improving the user experience.
[0081] In an exemplary embodiment, if Figure 2As shown, the specific implementation process of the step of "adjusting the pixel value of the initial image by the target pixel value adjustment parameter to obtain the target mixed image" may include:
[0082] In step 202, for each pixel in the initial image, an adjusted pixel value corresponding to the pixel is determined based on the target pixel value adjustment parameter and the pixel value of the pixel.
[0083] Specifically, for each pixel in the initial image, the terminal may calculate the adjusted pixel value corresponding to the pixel based on the determined target pixel value adjustment parameter and the pixel value of the pixel. For example, the pixel value of the pixel on the initial image may be a first pixel value, and the terminal may calculate based on the first pixel value and the target pixel value adjustment parameter to obtain a second pixel value, and determine the second pixel value as the adjusted pixel value corresponding to the pixel.
[0084] In step 204, the initial image is adjusted based on the adjusted pixel values corresponding to each pixel point to obtain a target mixed image.
[0085] Specifically, the terminal can configure each pixel on the initial image based on the adjusted pixel values corresponding to each pixel, configure the pixel value of each pixel on the initial image to the adjusted pixel value corresponding to each pixel, and obtain the target mixed image based on the adjusted pixel points; in one example, the terminal can determine the configured initial image as the target mixed image.
[0086] Optionally, for each pixel point on the initial image, the pixel value of the pixel point may be, for example, a first pixel value, and the first pixel value of the pixel point is adjusted and calculated based on the target pixel value adjustment parameter, and the obtained pixel value may be a second pixel value. The terminal may configure the pixel point in the initial image to the second pixel value. The terminal may perform the method described in the above embodiment on each pixel point on the initial image to obtain a configured initial image, and determine the configured initial image as the target mixed image.
[0087] Based on the above scheme, the initial image is configured based on the calculated adjusted pixel values to ensure the accuracy of the obtained target mixed image.
[0088] In an exemplary embodiment, the image processing method further includes:
[0089] The first real-time image is overlaid with the target mixed image to obtain a second real-time image, and the second real-time image is output.
[0090] Specifically, the target mixed image may be an image obtained by mixing the initial image and each image to be mixed, the image to be mixed may be an image processed by the user through a drawing tool, the first real-time image may be an image acquired by the terminal through an image acquisition device on the terminal, and after the terminal acquires the first real-time image through the image acquisition device, the first real-time image may be rendered and overlaid through the target mixed image to obtain a second real-time image, and the second real-time image may be output, for example, the second real-time image may be displayed by the terminal.
[0091] Based on the above solution, the image quality output by the terminal can be improved.
[0092] The specific implementation process of the above image processing method is described in detail below in conjunction with a specific embodiment:
[0093] In the field of digital image processing, image blending and layer overlay are widely used in special effects rendering, user interface (UI) design, digital image creation and other fields. By overlaying multiple images in different blending modes and sequences, a rich variety of visual effects can be generated. In related technologies, for example, if a series of layers need to be superimposed to form a new image, then the base image and the upper layer image are calculated and superimposed in sequence according to the corresponding blending formula until the superposition is completed. As the number of blending layers increases, the required blended images and calculation steps increase accordingly. The image data that needs to be stored and transmitted is huge, and the calculation complexity is high, resulting in a low efficiency of image blending processing.
[0094] The image processing method provided in this embodiment can reduce the computational complexity in the image mixing process and reduce the image data that needs to be transmitted under the premise of ensuring the quality of image mixing when there are many mixed images. In the process from image creation to image rendering, there is the following process: first, the designer creates the material and uses mature drawing software such as PS and AI to draw some images. The purpose is to mix and superimpose the images, and then transmit these images to the mobile terminal, and finally superimpose and render the layers on the mobile terminal to achieve a colorful rendering effect. The image processing method provided in this embodiment can process the created image as an image to be mixed, and reduce the number of images and the total size of the image by mixing and merging, greatly reducing the number of images and the number of mixing operations. Specifically, the present invention can simplify the image mixing of the mixed mode of a polynomial of any order and any number of times to twice the existing mode, greatly reducing the number of image mixing and the computational complexity.
[0095] Specifically, an image mixture of an overlay image Y and a base image X can be represented as a kx+b form, and this image mixing mode is a mixing mode of a first-order polynomial. For example, the expression for multiply is: B(X,Y)=X*Y, where k is Y and b is 0. When the mixing modes corresponding to the images to be mixed are all first-order polynomials, the image processing method provided in this embodiment can perform nested processing on the correspondence between the input pixel values and the output pixel values corresponding to each mixing mode, and obtain a target correspondence, which is a first-order polynomial obtained after merging.
[0096] The mixing modes that satisfy the first-order polynomial may include one or more of the following: multiply, normal, screen, add, hardlight, exclude. The expressions corresponding to the mixing modes can all be expressed in the form of kx+b, where the corresponding k and b are shown in Table 1 below:
[0097] Table 1
[0098]
[0099]
[0100] Specifically, since multiply mixing is to multiply the overlay image by the base image, which is equivalent to a multiplication, and add mixing is to add the overlay image to the base image, which is equivalent to an addition, the multiplication and addition of kx+b can be represented by a multiply and an add respectively. That is, any mixing operation that can be expressed by a polynomial can be represented by a combination of a multiply and an add.
[0101] In a specific embodiment, Figure 3 As shown, a base image, namely a model face image, and eight overlay images (in different first-order polynomial mixing modes) are mixed to obtain a target mixed image; through the image processing method provided in this embodiment, as Figure 4As shown, eight images to be mixed are mixed, and the eight images to be mixed can be optimized into two images (one multiply mixing and one add mixing), that is, the mixing operation is reduced from eight times to two times, and the base image is processed by adjusting the parameters of the target pixel values represented by the optimized image to obtain the target mixed image. The image processing method provided in this embodiment can greatly optimize the performance, and the mixing results before and after the optimization remain consistent. If the mixing modes corresponding to the images to be mixed of the initial image are of the same type, the target correspondence relationship obtained by the terminal through mixing the mixing modes corresponding to the images to be mixed is consistent with the mixing modes corresponding to the above-mentioned images to be mixed. That is to say, if the mixing modes corresponding to the images to be mixed are multiple consecutive multiply mixing modes, or multiple consecutive add modes, or multiple consecutive normal modes, or multiple consecutive softlight mixing modes, the image processing method provided in this embodiment can merge the above-mentioned multiple consecutive mixing modes respectively, for example, merging multiple consecutive multiply mixing modes to obtain a multiply; merging multiple consecutive add modes to obtain an add, or merging multiple consecutive normal modes to obtain a normal, or multiple consecutive softlight mixing modes to obtain a softlight.
[0102] The image processing method provided in this embodiment can merge the mixing modes of linear polynomials that meet the conditions, and can merge linear polynomials of any number of times and in any order into two times. On the basis of ensuring the quality of the output target mixed image remains unchanged, the number of images involved in image mixing and the number of mixing operations are greatly reduced, thereby reducing the computational complexity of the image mixing process.
[0103] The effect of the image processing method provided in this embodiment can be that among the top 2500 magic watch materials with the highest frequency on the daily data line, the beauty function uses a total of 15781 image mixings. After optimization by this solution, it can be reduced to 4351 image mixings, with an optimization rate of 72%. And considering the optimization and improvement of the performance by the number of beauty mixing layers, taking the magic watch material with the magic watch ID of 3626799 as an example, its original number of beauty layers is 33 layers. After being simplified to 5 layers by this solution, the performance test is carried out on the Redmi K30 mobile phone. Its CPU time optimization rate reaches 78%, and its GPU time optimization rate reaches 65%. It can be seen that the mixing and merging has a direct improvement on performance optimization. In other words, the image processing method provided in this embodiment can abstract and unify the expression of the mixing mode, mix and merge the mixing modes of the first-order polynomials, and simplify the mixing of any order and any number of times within the range of the six mixing modes to 2 times, thereby improving performance.
[0104] It should be understood that although Figure 1-Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 2 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0105] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.
[0106] Figure 5 FIG. 5 is a block diagram of an image processing apparatus 500 according to an exemplary embodiment. Figure 5 The device includes an acquisition unit 502, a hybrid determination unit 504 and an adjustment unit 506.
[0107] The acquisition unit 502 is configured to acquire an initial image and each image to be mixed, and determine a mixing mode corresponding to each image to be mixed.
[0108] The mixing determination unit 504 is configured to execute based on each to-be-mixed image and the mixing mode corresponding to each to-be-mixed image, and obtain a target pixel value adjustment parameter.
[0109] The adjustment unit 506 is configured to adjust the pixel value of the initial image by using the target pixel value adjustment parameter to obtain a target mixed image.
[0110] In one embodiment, the mixing mode includes a correspondence between input pixel values and output pixel values; and the mixing determination unit includes:
[0111] The first determination subunit is configured to execute a target correspondence relationship based on the correspondence relationship between the input pixel values and the output pixel values corresponding to each of the images to be mixed, and determine a target pixel value adjustment parameter based on the target correspondence relationship and the pixel values corresponding to each of the images to be mixed, wherein the target correspondence relationship represents the correspondence relationship between the input pixel values and the output pixel values after mixing based on each of the mixing modes.
[0112] In one embodiment, the first determining subunit is specifically configured to:
[0113] According to the arrangement order of the images to be mixed, processing is performed based on the correspondence between the input pixel values and the output pixel values corresponding to the images to be mixed, so as to obtain the target correspondence.
[0114] In one embodiment, the mixing modes corresponding to the images to be mixed include different types of mixing modes, or the same type of mixing modes.
[0115] In one embodiment, the adjustment unit comprises:
[0116] A second determining subunit is configured to determine, for each pixel in the initial image, an adjusted pixel value corresponding to the pixel based on the target pixel value adjustment parameter and the pixel value of the pixel;
[0117] The adjustment subunit is configured to adjust the initial image based on the adjusted pixel values corresponding to each of the pixel points to obtain a target mixed image.
[0118] In one embodiment, the apparatus further comprises:
[0119] The output unit is configured to perform superposition processing on the first real-time image through the target mixed image to obtain a second real-time image, and output the second real-time image.
[0120] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0121] Figure 6 1 is a block diagram of an electronic device 600 for an image processing method according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0122] Reference Figure 6 , the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .
[0123] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0124] The memory 604 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, optical disk, or graphene memory.
[0125] The power supply component 606 provides power to the various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.
[0126] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0127] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting an audio signal.
[0128] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0129] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the electronic device 600, the relative positioning of the components, such as the display and keypad of the electronic device 600, and the sensor assembly 614 can also detect the position change of the electronic device 600 or the components of the electronic device 600, the presence or absence of contact between the user and the electronic device 600, the orientation or acceleration / deceleration of the device 600 and the temperature change of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0130] The communication component 616 is configured to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0131] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0132] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the above instructions can be executed by the processor 620 of the electronic device 600 to perform the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0133] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by the processor 620 of the electronic device 600 to complete the above method.
[0134] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.
[0135] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0136] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An image processing method, characterized in that: include: Acquire an initial image and each image to be mixed, and determine a mixing mode corresponding to each of the images to be mixed; Based on the images to be mixed and the mixing modes respectively corresponding to the images to be mixed, a target pixel value adjustment parameter is obtained; The pixel values of the initial image are adjusted using the target pixel value adjustment parameters to obtain a target mixed image.
2. The image processing method according to claim 1, characterized in that: The mixing mode includes a correspondence between an input pixel value and an output pixel value; and obtaining a target pixel value adjustment parameter based on each of the images to be mixed and the mixing mode corresponding to each of the images to be mixed includes: Based on the correspondence between the input pixel values and the output pixel values corresponding to each of the images to be mixed, a target correspondence is obtained, and based on the target correspondence and the pixel values corresponding to each of the images to be mixed, a target pixel value adjustment parameter is determined, wherein the target correspondence represents the correspondence between the input pixel values and the output pixel values after mixing based on each of the mixing modes.
3. The image processing method according to claim 2, characterized in that: The processing of the pixel values of each of the images to be mixed based on the correspondence between the input pixel values and the output pixel values corresponding to each of the images to be mixed to obtain the target correspondence includes: According to the arrangement order of the images to be mixed, processing is performed based on the correspondence between the input pixel values and the output pixel values corresponding to the images to be mixed, so as to obtain the target correspondence.
4. The image processing method according to claim 1, characterized in that: The mixing modes corresponding to the images to be mixed include mixing modes of different types or mixing modes of the same type.
5. The image processing method according to any one of claims 1 to 5, characterized in that: The step of adjusting the pixel value of the initial image by using the target pixel value adjustment parameter to obtain a target mixed image includes: For each pixel in the initial image, based on the target pixel value adjustment parameter and the pixel value of the pixel, determine an adjusted pixel value corresponding to the pixel; Based on the adjusted pixel values respectively corresponding to the pixel points, the initial image is adjusted to obtain a target mixed image.
6. The image processing method according to any one of claims 1 to 5, characterized in that: The method further comprises: The first real-time image is overlaid with the target mixed image to obtain a second real-time image, and the second real-time image is output.
7. An image processing device, characterized in that: include: An acquisition unit is configured to acquire an initial image and each image to be mixed, and determine a mixing mode corresponding to each image to be mixed; A mixing determination unit is configured to execute based on each of the to-be-mixed images and the mixing modes respectively corresponding to each of the to-be-mixed images to obtain a target pixel value adjustment parameter; The adjustment unit is configured to adjust the pixel value of the initial image by using the target pixel value adjustment parameter to obtain a target mixed image.
8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the image processing method according to any one of claims 1 to 6.
10. A computer program product, comprising instructions, characterized in that: When the instruction is executed by a processor of an electronic device, the electronic device is enabled to execute the image processing method as described in any one of claims 1 to 6.