CN-121982121-A - Image processing method, apparatus, electronic device, storage medium and program product
Abstract
The present disclosure relates to the field of image processing technologies, and in particular, provides an image processing method, an image processing device, an electronic device, a storage medium, and a program product. The method comprises the steps of obtaining a source image layer and an image layer to be processed according to an image layer synthesis instruction, obtaining a mask layer corresponding to the image layer to be processed, performing color mixing treatment on the mask layer and the image layer to be processed to obtain a target processing image layer, and synthesizing the source image layer and the target processing image layer to obtain a target synthesized image. Therefore, the color mixing treatment is performed on the layer to be processed through the mask layer, and then the layer synthesis is performed, so that the layer operation through the GPU is not needed, the resources consumed by the GPU are reduced, the load of the GPU is reduced, and the equipment performance is improved.
Inventors
- XIN YING
- LIU XIUQUAN
Assignees
- 北京小米移动软件有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20241029
Claims (10)
- 1. A method of image processing, the method comprising: acquiring a source layer and a layer to be processed according to a layer composition instruction; Acquiring a mask layer corresponding to the layer to be processed; performing color mixing treatment on the mask layer and the layer to be treated to obtain a target treatment layer; and synthesizing the source image layer and the target processing image layer to obtain a target synthesized image.
- 2. The method according to claim 1, wherein the obtaining a mask layer corresponding to the layer to be processed includes: Acquiring a synthesis intention identifier in the layer synthesis instruction; and acquiring a mask layer corresponding to the synthesis intention identifier.
- 3. The method of claim 2, wherein prior to performing a color mixing process on the mask layer and the layer to be processed to obtain a target processed layer, the method further comprises: Acquiring layer information of the layer to be processed; And adjusting the mask layer according to the synthesis intention mark and the layer information to obtain an adjusted mask layer.
- 4. A method according to any one of claims 1 to 3, wherein the step of performing a color mixing process on the mask layer and the layer to be processed to obtain a target processed layer comprises: Obtaining a target pixel matrix of the target processing layer according to the product of a first pixel matrix of the mask layer and a second pixel matrix of the layer to be processed, wherein the first pixel matrix represents the color and the transparency of each pixel in the mask layer, and the second pixel matrix represents the color and the transparency of each pixel in the layer to be processed.
- 5. A method according to any one of claims 1-3, wherein prior to obtaining a mask layer corresponding to the layer to be processed, the method further comprises: the method comprises the steps of initially setting the color and the transparency of a mask layer; acquiring mask layer configuration parameters set according to the synthesis intention; And rendering the mask layer after initial setting according to the mask layer configuration parameters to obtain the mask layer after rendering.
- 6. An apparatus for image processing, the apparatus comprising: The receiving unit is used for acquiring a source layer and a layer to be processed according to the layer synthesis instruction; The acquisition unit is used for acquiring a mask layer corresponding to the layer to be processed; The color mixing unit is used for carrying out color mixing treatment on the mask layer and the layer to be treated to obtain a target treatment layer; and the synthesis unit is used for synthesizing the source image layer and the target processing image layer to obtain a target synthesized image.
- 7. The apparatus of claim 6, wherein the obtaining a mask layer corresponding to the layer to be processed comprises: Acquiring a synthesis intention identifier in the layer synthesis instruction; and acquiring a mask layer corresponding to the synthesis intention identifier.
- 8. An electronic device, comprising: processor, and A memory storing computer instructions for causing the processor to perform the method of any one of claims 1 to 5.
- 9. A computer readable storage medium, characterized in that computer instructions are stored for causing a computer to perform the method according to any one of claims 1 to 5.
- 10. A computer program product comprising computer readable code, or a non-transitory computer readable storage medium carrying computer readable code, which when run in a processor of an electronic device, the processor of the electronic device being in accordance with the method of any one of claims 1 to 5.
Description
Image processing method, apparatus, electronic device, storage medium and program product Technical Field The present disclosure relates to the field of image processing technologies, and in particular, to a method, an apparatus, an electronic device, a storage medium, and a program product for image processing. Background In an image processing scene, it is generally required to synthesize a plurality of layers according to actual application requirements, so as to obtain a synthesized image satisfying the synthesis intention (e.g., drawing a window fillet, increasing a shadow, blurring an image, etc.), and display the synthesized image on a screen. In related art, in some complex scenarios, an application programming interface (Application Programming Interface, API) such as an open graphics library (Open Graphics Library, openGL) is generally called by a graphics processor (Graphics Processing Unit, GPU) to perform an operation on a target processing layer (e.g., performing a corner clipping on the target processing layer), and then, the operated target processing layer is synthesized with a source layer to obtain a synthesized layer. In this manner, however, the GPU consumes a significant amount of resources, which in turn reduces device performance. Disclosure of Invention An object of an embodiment of the present disclosure is to provide a method, an apparatus, an electronic device, a storage medium, and a program product for image processing, so as to reduce resources consumed by a GPU during image synthesis. In one aspect, an embodiment of the present disclosure provides a method for image processing, including: acquiring a source layer and a layer to be processed according to a layer composition instruction; Acquiring a mask layer corresponding to a layer to be processed; performing color mixing treatment on the mask layer and the layer to be treated to obtain a target treatment layer; and synthesizing the source layer and the target processing layer to obtain a target synthesized image. In one embodiment, obtaining a mask layer corresponding to a layer to be processed includes: obtaining a synthesis intention identifier in a graph synthesis instruction; and obtaining a mask layer corresponding to the synthesis intention identifier. In one embodiment, before performing the color mixing treatment on the mask layer and the layer to be processed to obtain the target processing layer, the method further includes: acquiring layer information of a layer to be processed; and adjusting the mask layer according to the synthesis intention mark and the layer information to obtain an adjusted mask layer. In one embodiment, performing color mixing treatment on a mask layer and a layer to be processed to obtain a target processing layer, including: Obtaining a target pixel matrix of the target processing layer according to the product of a first pixel matrix of the mask layer and a second pixel matrix of the layer to be processed, wherein the first pixel matrix represents the color and the transparency of each pixel in the mask layer, and the second pixel matrix represents the color and the transparency of each pixel in the layer to be processed. In one embodiment, before obtaining the mask layer corresponding to the layer to be processed, the method further includes: the method comprises the steps of initially setting the color and the transparency of a mask layer; acquiring mask layer configuration parameters set according to the synthesis intention; and rendering the mask layer after initial setting according to the mask layer configuration parameters to obtain the mask layer after rendering. In one aspect, an embodiment of the present disclosure provides an apparatus for image processing, including: The receiving unit is used for acquiring a source layer and a layer to be processed according to the layer synthesis instruction; The acquisition unit is used for acquiring a mask layer corresponding to the layer to be processed; the color mixing unit is used for carrying out color mixing treatment on the mask layer and the layer to be treated to obtain a target treatment layer; And the synthesis unit is used for synthesizing the source image layer and the target processing image layer to obtain a target synthesized image. In one embodiment, the obtaining unit is configured to: obtaining a synthesis intention identifier in a graph synthesis instruction; and obtaining a mask layer corresponding to the synthesis intention identifier. In one embodiment, the color mixing unit is further configured to: acquiring layer information of a layer to be processed; and adjusting the mask layer according to the synthesis intention mark and the layer information to obtain an adjusted mask layer. In one embodiment, the color mixing unit is for: Obtaining a target pixel matrix of the target processing layer according to the product of a first pixel matrix of the mask layer and a second pixel matrix of the layer to be processed, w