Image processing method and device and electronic equipment
By generating and adjusting the transparency of the mask image, the problem of poor effect of scene images generated by AIGC in image fusion is solved, and a better image fusion effect is achieved.
Patent Information
- Application Number
- CN202411150234.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-15
AI Technical Summary
The scene images generated by existing AIGC are prone to poor results due to differences in content and color when the image is fused.
By generating a mask image containing the border area and the target area, and adjusting the transparency of the target image with transparent pixels, the target image is generated to facilitate image fusion, the border area is used as background material, and the target area is used as transparent area of the foreground image.
Improve the fusion effect of foreground images and background materials, and enhance the quality of image fusion.
Smart Images

Figure CN118967543A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device and electronic device. Background Art
[0002] With the development of artificial intelligence technology, the technology of generating pictures using artificial intelligence generated content (AIGC) has emerged and has gradually been applied to various fields such as art creation, entertainment, and design.
[0003] AIGC technology generates images that match the description of the information content based on the information input by the user. However, the scene images currently generated by AIGC are usually based on characters, cartoons, animations, etc. as the main elements, and are combined with the style set by the user. When using the above scene images for image fusion, the scene images and other images are prone to differences in image content, color, etc., resulting in poor fused image effects. Summary of the invention
[0004] The embodiments of the present application provide an image processing method, device and electronic device to solve the problem of poor image effect when image fusion is performed based on scene images.
[0005] To solve the above technical problems, this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0007] Generate a first mask image corresponding to a first image to be processed, wherein the first image includes a frame area and a target area located within the frame area, the first mask image includes a first area corresponding to the frame area and a second area corresponding to the target area, pixels in the first area are non-transparent pixels, and pixels in the second area are transparent pixels;
[0008] The first mask image is superimposed on the first image, and the pixel transparency of the target area of the first image is adjusted using transparent pixels of the second area of the first mask image to obtain a target image, wherein the target area of the target image is transparent pixels.
[0009] Optionally, before generating a first mask image corresponding to the first image to be processed, the method further includes:
[0010] Processing pixels of a second image to generate a second mask image, wherein the second image includes a third area and a fourth area, the third area corresponds to the frame area, and the fourth area corresponds to the target area;
[0011] The second mask image is superimposed on the second image, and the pixels of the third area of the second image are processed according to the area range indicated by the third area of the second mask image to obtain the first image, wherein the color pixel value of the third area of the second mask image is not 0, the color pixel value of the fourth area of the second mask image is 0, and the color pixel value is a value used to represent the pixel color.
[0012] Optionally, before processing the color pixels of the second image to generate the second mask image, the method further includes:
[0013] generating a third image, wherein the third image is an image corresponding to the fourth area of the second image;
[0014] The second image is obtained by outwardly expanding the edge of the third image, wherein an extended area formed by outwardly expanding the third image is the third area of the second image.
[0015] Optionally, the image corresponding to the target image in the frame area includes a frame image, and the frame image is generated by processing pixels in the frame area according to preset keywords.
[0016] Optionally, using transparent pixels in the second area of the first mask image to adjust pixel transparency in the target area of the first image to obtain the target image includes:
[0017] Acquire a first transparency pixel value of the first area and a second transparency pixel value of the second area of the first mask image, wherein the transparency pixel value is a value used to represent pixel transparency;
[0018] Based on the first transparency pixel value and the second transparency pixel value, determining the target area corresponding to the second area where the transparency pixel is 0 in the first image;
[0019] The pixel transparency of the target area of the first image is adjusted to obtain the target image.
[0020] Optionally, before generating a first mask image corresponding to the first image to be processed, the method further includes:
[0021] Receiving a target instruction input by a user, wherein the target instruction includes a first sub-instruction and a second sub-instruction;
[0022] The step of generating a first mask image corresponding to the first image to be processed includes:
[0023] In response to the first sub-instruction, generating a first mask image corresponding to the first image to be processed;
[0024] The step of superimposing the first mask image with the first image and adjusting the pixel transparency of the target area of the first image by using the transparent pixels of the second area of the first mask image to obtain the target image includes:
[0025] In response to the second sub-instruction, the first mask image is superimposed on the first image, and the pixel transparency of the target area of the first image is adjusted by using the transparent pixels of the second area of the first mask image to obtain the target image.
[0026] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0027] A first generating module is used to generate a first mask image corresponding to a first image to be processed, wherein the first image includes a frame area and a target area located in the frame area, the first mask image includes a first area corresponding to the frame area and a second area corresponding to the target area, the pixels in the first area are non-transparent pixels, and the pixels in the second area are transparent pixels;
[0028] An adjustment module is used to superimpose the first mask image with the first image, and use the transparent pixels of the second area of the first mask image to adjust the pixel transparency of the target area of the first image to obtain a target image, wherein the target area of the target image is a transparent pixel.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the image processing method described in the first aspect.
[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image processing method described in the first aspect are implemented.
[0031] According to a fifth aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the image processing method as described in the first aspect.
[0032] In an embodiment of the present application, a target image is generated using a first image and a first mask image, wherein the border area of the target image includes the image within the border area of the first image, and the middle portion of the target image is a transparent area. In this way, when the target image is used for image fusion, the foreground image to be fused is set in the transparent area of the target image, and the image within the border area of the target image can be used as background material, which can improve the fusion effect of the foreground image and the background material. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1 This is one of the flow charts of an image processing method provided in an embodiment of the present application;
[0035] Figure 2 is a schematic diagram of an image processing process provided by an embodiment of the present application;
[0036] Figure 3 This is the second flowchart of an image processing method provided in an embodiment of the present application;
[0037] Figure 4 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0038] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] See also Figure 1 , Figure 1 is a flow chart of an image processing method provided in an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0041] Step 101: Generate a first mask image corresponding to a first image to be processed, wherein the first image includes a frame area and a target area within the frame area, the first mask image includes a first area corresponding to the frame area and a second area corresponding to the target area, pixels in the first area are non-transparent pixels, and pixels in the second area are transparent pixels;
[0042] Step 102: superimpose the first mask image with the first image, and use the transparent pixels of the second area of the first mask image to adjust the pixel transparency of the target area of the first image to obtain a target image, wherein the target area of the target image is transparent pixels.
[0043] The first image to be processed may be obtained by any means, for example, online download, local storage, or generation using an image generation model. The first image includes a frame area around the image and a target area within the frame area. The frame area of the first image may contain an image, which may be a background image for image fusion, for example, a single color image or an image with a specific shape.
[0044] A first mask image is generated using the first image, wherein pixels of the first mask image corresponding to a first area of the frame area are non-transparent pixels, and pixels of the first mask image corresponding to a second area of the target area are transparent pixels.
[0045] like Figure 2 As shown, after obtaining the first mask image, the first mask image is superimposed on the first image, the first area of the first mask image coincides with the frame area of the first image, and the second area of the first mask image coincides with the target area of the first image. Since the second area of the first mask image is a transparent pixel, the transparent pixel is applied to the target area of the first image, and the target area of the target image is obtained as a transparent pixel; while the first area of the first mask image is a non-transparent pixel, the first area corresponds to the frame area of the first image, and the pixels in the frame area of the first image are reserved as the pixels of the frame area of the target image. The target image generated by the above method, wherein the pixels in the frame area of the target image are the same as the pixels in the frame area of the first image, and the pixels in the target area of the target image are transparent pixels.
[0046] For ease of understanding, a specific implementation is given below as an example.
[0047] For example, the user opens the image generation model, and builds a basic workflow by adding nodes and filling in feature words. First, the Layer Diffuse Decode node (used to generate an Alpha image based on the input RGB image) is added through user operation, and the first image is input to the node to generate the first mask image. Then, the ApplyMask to Image node (used to apply the first mask image to the first image) is added through user operation, the first image and the first mask image are input to the node, and the transparent pixels of the second area of the first mask image are applied to the target area of the first image to generate the target image.
[0048] The shape of the above-mentioned border area can be circular or square, or other irregular shapes, which can be determined specifically according to the edge shape of the first image. The target area is surrounded by the border area, and the target area is a transparent area. The transparent area can be used to set the foreground image corresponding to the person or animal that needs to be fused, and the image corresponding to the border area can be used as the background image to be fused with the foreground image, which can improve the effect of the fused image.
[0049] Optionally, before generating a first mask image corresponding to the first image to be processed, the method further includes:
[0050] Processing pixels of a second image to generate a second mask image, wherein the second image includes a third area and a fourth area, the third area corresponds to the frame area, and the fourth area corresponds to the target area;
[0051] The second mask image is superimposed on the second image, and the pixels of the third area of the second image are processed according to the area range indicated by the third area of the second mask image to obtain the first image, wherein the color pixel value of the third area of the second mask image is not 0, the color pixel value of the fourth area of the second mask image is 0, and the color pixel value is a value used to represent the pixel color.
[0052] The second image to be processed may be pre-acquired, for example, by online download, local storage, or image generation model generation, etc., and is not specifically limited. The second image includes a third area corresponding to the border area of the first image, and a fourth area corresponding to the target area of the first image.
[0053] like Figure 2As shown, after acquiring the second image, the pixels of the second image are processed to generate the second mask image. Since the process of generating the second mask image from the second image is by processing the image pixels, the second mask image has the same third area and fourth area as the second image. The pixels of the third area and the fourth area of the second image may be the same or different. Figure 2 The pixels of the third area and the fourth area of the second image shown in are the same. The pixels of different areas of the second image may be processed, for example, the pixels in the third area and the fourth area may be binarized to generate the second mask image, or the pixels in the border area may be feathered to obtain the second mask image.
[0054] When the pixels of the second image are processed according to the area range indicated by the second mask image to obtain the first image, the second mask image and the second image are superimposed, and the third areas of the second image and the second mask image are the same, and the fourth areas of the second image and the second mask image are the same. The fourth area of the second mask image is black (the color pixel is 0), and the target area corresponding to the fourth area is the area that does not need to be processed; the third area of the second mask image is white (the color pixel is not 0), and the border area corresponding to the third area is the area that needs to be processed. In other words, the first image is generated after processing the pixels of the third area of the second image. Figure 2 As shown, the pixels in the third area of the second image are denoised to generate the first image, and the pixels in the fourth area of the second image are not processed, and the original pixels are retained. The color pixel can be a value used to represent the color of the pixel, for example, the RGB value of the pixel.
[0055] In order to facilitate understanding of the above implementation, a specific implementation is given as an example below.
[0056] For example, the user opens the image generation model and builds a basic workflow by adding nodes and filling in feature words. First, the second image is input and feathered to obtain a second mask image with black in the middle and white in the border. Then, by adding a VAE Encode (for Inpainting) node (used to encode the pixel space image into a latent space image and denoise), the second mask image and the second image are input to the above node, and then the image output by the node is input to the KSampler node (used to generate a new version of a given latent image using the provided model and positive and negative conditions). Based on the second image, the corresponding image of the third area of the second mask image is denoised to obtain a background border image, while the fourth area of the second image is not processed. In the first image generated using the second image and the second mask image, the border area is an image generated by processing the third area of the second image, and the pixels of the target area are the same as the pixels of the fourth area of the second image.
[0057] The first image is generated by using the second image and the second mask image, so that the first image including the background frame can be quickly generated.
[0058] Optionally, before processing the color pixels of the second image to generate the second mask image, the method further includes:
[0059] generating a third image, wherein the third image is an image corresponding to the fourth area of the second image;
[0060] The edge of the third image is expanded outward to obtain the second image, wherein the extended area formed by the outward expansion of the third image is the third area of the second image
[0061] When generating the third image, corresponding parameters may be input according to the image features (eg, shape, size, and style) to be generated, thereby generating the third image. Figure 2 Taking the image shown in as an example, the third image is an image corresponding to the fourth area of the second image.
[0062] Edge extension is performed based on the third image to obtain an extended image, i.e., a second image, wherein the area corresponding to the third image corresponds to the fourth area of the second image, the area corresponding to the extended image corresponds to the third area of the second image, and the third image and the image corresponding to the extended area together form the second image.
[0063] In order to facilitate understanding of the above implementation, a specific implementation is given as an example below.
[0064] For example, the user opens the image generation model, builds a basic workflow by adding nodes and filling in feature words. Add Empty Latent Image (used to create a new set of empty latent images) and VAE Decode nodes (used to decode the latent space image back to the pixel space image using the provided VAE), set the width and height, and output a gray-filled image, i.e. the third image. Add Pad Image for Outpainting nodes (used to add padding to the image for repair), input the gray image obtained previously, set the width of the top, bottom, left, and right expansions, and output an enlarged gray-filled image, i.e. the second image.
[0065] By means of the above method, a second image including an image corresponding to the extended area and the third image can be quickly generated.
[0066] Optionally, the image corresponding to the target image in the frame area includes a frame image, and the frame image is generated by processing pixels in the frame area according to preset keywords.
[0067] The above-mentioned preset keywords can be pre-input by the user or input during the image generation process. The keywords can include one or more. The keywords can be used to reflect the style, content characteristics, etc. of the image. For example, when the user inputs the two keywords "outdoor" and "scenery", a border image about outdoor scenery can be generated; when the keyword includes plum blossoms, the border image generated based on the keyword contains plum blossoms; when the keyword is animation, a border image including animation elements is generated.
[0068] According to the input keyword, the pixels in the frame area of the second image are processed to generate a frame image corresponding to the features indicated by the keyword. In specific execution, the second mask image can be used to indicate the processing of a specific area of the second image. Since the pixels in the third area of the second mask image are non-zero, the third area of the second image is processed to generate the above-mentioned frame image. The above-mentioned processing method for the pixels in the frame area, such as denoising processing, painting processing, etc., is used to obtain the frame image.
[0069] Optionally, using transparent pixels in the second area of the first mask image to adjust pixel transparency in the target area of the first image to obtain the target image includes:
[0070] Acquire a first transparency pixel value of the first area and a second transparency pixel value of the second area of the first mask image, wherein the transparency pixel value is a value used to represent pixel transparency;
[0071] Based on the first transparency pixel value and the second transparency pixel value, determining the target area corresponding to the second area having a transparency pixel value of 0 in the first image;
[0072] The pixel transparency of the target area of the first image is adjusted to obtain the target image.
[0073] The transparency pixel value is a value indicating the transparency of a pixel, for example, the Alpha value of a pixel, which is used to indicate the transparency of a pixel. The first transparency pixel value of the first area of the first mask image is not 0 (i.e., a non-transparent pixel), and the second transparency pixel value of the second area of the first mask image is 0 (i.e., a transparent pixel). A second area having a transparency pixel value of 0 is obtained, and a target area corresponding to the second area is determined in the first image, so that the pixel transparency of the target area is adjusted according to the pixel transparency of the second area. In other words, the pixel transparency of the target area is adjusted to a transparent pixel.
[0074] For example, the first mask image is used as the transparency map of the first image and is put into the Alpha channel of the first image (used to reflect the transparency of the image). The first area and the second area of the first mask image correspond to the frame area and the target area of the first image respectively, and the pixels of the Alpha channel of the target area of the obtained target image are 0, that is, transparent pixels, and the pixels of the Alpha channel of the frame area of the target image are the pixels corresponding to the frame area of the first image, that is, non-transparent pixels, so as to obtain a target image including a frame image and a transparent area.
[0075] After obtaining the above target image, when image fusion is required, the border area of the target image can be used as background material, and the foreground image to be fused is set in the transparent area of the target image, so as to obtain a fused image.
[0076] Optionally, before generating a first mask image corresponding to the first image to be processed, the method further includes:
[0077] Receiving a target instruction input by a user, wherein the target instruction includes a first sub-instruction and a second sub-instruction;
[0078] The step of generating a first mask image corresponding to the first image to be processed includes:
[0079] In response to the first sub-instruction, generating a first mask image corresponding to the first image to be processed;
[0080] The step of superimposing the first mask image with the first image and adjusting the pixel transparency of the target area of the first image by using the transparent pixels of the second area of the first mask image to obtain the target image includes:
[0081] In response to the second sub-instruction, the first mask image is superimposed on the first image, and the pixel transparency of the target area of the first image is adjusted by using the transparent pixels of the second area of the first mask image to obtain the target image.
[0082] In this embodiment, the target image can be obtained based on the instruction input by the user. Before the image is generated, the user can input the target instruction in advance, and generate the first mask image and the target image according to the first sub-instruction and the second sub-instruction in the target instruction. In this process, the target image can be obtained without the user having to manually operate again, which can reduce user operations and improve image processing efficiency.
[0083] In addition, the target instruction may also include a third sub-instruction, a fourth sub-instruction, a fifth sub-instruction... In the above process of generating a third image, generating a second image using the third image, generating a first image using the second image..., the above images can also be generated in sequence according to the sub-instructions in the target instruction.
[0084] In this way, the user can first input the target instruction, and generate the target image according to the sub-instructions in the target instruction. During the image generation and processing process, the user does not need to perform operations again, which can reduce user operations and improve the efficiency of image generation and processing.
[0085] As a specific embodiment, Figure 2 and Figure 3 As shown, the above image processing method includes the following process:
[0086] 1. Build a basic workflow: start the image generation software, add the Load Checkpoint node (used to load the diffusion model), load the SDXL model (the latest generation of image generation model), add the CLIP Text Encode node (used to encode text prompts into embeddings using the CLIP model, which can be used to guide the diffusion model to generate specific images), fill in the positive and negative prompt words, add KSampler (uses the provided model and positive and negative conditions to generate a new version of a given latent image), VAEDecode (used to decode the latent space image back to the pixel space image using the provided VAE), Save Image and other nodes, connect the nodes to build a basic workflow.
[0087] 2. Control the model drawing area and generate a basic border image: First, add the Empty Latent Image (used to create a new set of empty latent images) and the VAE Decode node (used to decode the latent space image back to the pixel space image using the provided VAE), set the image width and height values, and output a gray-filled image (the image corresponding to the fourth area of the second image, i.e., the third image). Then, add the Pad Image for Outpainting node (used to add padding to the image for repair), input the previously obtained gray image (the third image), set the width value and edge feather value of the top, bottom, left, and right expansion ( Figure 2 The feather value in is 0), and an enlarged image filled with gray (the second image) and a second mask image (mask) with a black middle and a white outer border are output.
[0088] Add a VAE Encode (for Inpainting) node (encode the pixel space image into a latent space image, and use the mask for inpainting to indicate to the sampler node which parts of the image should be denoised), and input the previously obtained enlarged gray image (second image) and mask (second mask image), and then input the output node as a latent image to the KSampler (use the provided model and positive and negative conditions to generate a new version of the given latent image) node. In this way, based on the gray image (second image), the mask (second mask image) can be used to indicate to the sampler node that the edge area of the image should be denoised. Among them, the white area of the mask (second mask image) is the area where the model generates the border, and the black part retains the original color of the gray image. Finally, a picture with gray in the middle and borders around it can be output in the VAE Decode node (first image).
[0089] 3. Calculate the mask image (mask) and obtain the Alpha map: add a Layer Diffuse Decode node (generate an Alpha map based on the input RGB image, the gray pixel area in the RGB image corresponds to the black area in the Alpha map, and other colors correspond to the white area in the Alpha map), input the output of the KSampler node and the VAE Decode node into Layer Diffuse Decode, and output a mask image (the first mask image). The white area of the image corresponds to the border pattern part of the image generated in step 2, and the black area of the image corresponds to the middle gray part.
[0090] 4. Apply the mask to get the final image: add an Apply Mask to Image node (used to apply the input mask to the alpha channel of the input image), input the mask image (first mask image) output by the Layer Diffuse Decode node and the border image (first image) output by the VAE Decode node, apply the mask as the alpha channel value to the border image, and then input the output of the Apply Mask to Image node into the Save Image node to output the final transparent background border image (target image).
[0091] In the embodiment of the present application, the target image obtained by the first image and the first mask image retains the image in the border area of the first image, and the target area of the target image is transparent pixels. When the target image is used for image fusion, the target image can be used as a background material, and the foreground image to be fused is set in the transparent area of the target image, which can improve the fusion effect of the foreground image and the background material. In addition, the target image can be used to generate video borders, posters, promotional images, etc.
[0092] See also Figure 4 , Figure 4 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application, such as Figure 4 As shown, the image processing device 400 includes:
[0093] A first generating module 401 is used to generate a first mask image corresponding to a first image to be processed, wherein the first image includes a frame area and a target area located within the frame area, the first mask image includes a first area corresponding to the frame area and a second area corresponding to the target area, the pixels of the first area are non-transparent pixels, and the pixels of the second area are transparent pixels;
[0094] The adjustment module 402 is used to superimpose the first mask image with the first image, and use the transparent pixels of the second area of the first mask image to adjust the pixel transparency of the target area of the first image to obtain a target image, wherein the target area of the target image is transparent pixels.
[0095] Optionally, the device further comprises:
[0096] A second generating module, configured to process pixels of a second image to generate a second mask image, wherein the second image includes a third area and a fourth area, the third area corresponds to the frame area, and the fourth area corresponds to the target area;
[0097] A processing module is used to superimpose the second mask image with the second image, and process the pixels of the third area of the second image according to the area range indicated by the third area of the second mask image to obtain the first image, wherein the color pixel value of the third area of the second mask image is not 0, the color pixel value of the fourth area of the second mask image is 0, and the color pixel value is a value used to represent the pixel color.
[0098] Optionally, the device further comprises:
[0099] A third generating module, configured to generate a third image, wherein the third image is an image corresponding to the fourth area of the second image;
[0100] An expansion module is used to expand the edge of the third image outward to obtain the second image, wherein the expansion area formed by the outward expansion of the third image is the third area of the second image.
[0101] Optionally, the image corresponding to the target image in the frame area includes a frame image, and the frame image is generated by processing pixels in the frame area according to preset keywords.
[0102] Optionally, the adjustment module includes:
[0103] An acquisition submodule, used to acquire a first transparency pixel value of the first area and a second transparency pixel value of the second area of the first mask image, wherein the transparency pixel value is a value used to represent pixel transparency;
[0104] a determination submodule, configured to determine, in the first image, the target area corresponding to the second area where the transparency pixel is 0 based on the first transparency pixel value and the second transparency pixel value;
[0105] The adjustment submodule is used to adjust the pixel transparency of the target area of the first image to obtain the target image.
[0106] The image processing device can realize Figure 1 The various processes implemented in the method embodiment can achieve the same technical effect, and to avoid repetition, they will not be described here.
[0107] like Figure 5 As shown, an embodiment of the present application further provides an electronic device 500, comprising: a processor 501, a memory 502, and a program stored in the memory 502 and executable on the processor 501. When the program is executed by the processor 501, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0108] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0109] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0110] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0111] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0112] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An image processing method, It is characterized in that include: Generate a first mask image corresponding to a first image to be processed, wherein the first image includes a frame area and a target area located within the frame area, the first mask image includes a first area corresponding to the frame area and a second area corresponding to the target area, pixels in the first area are non-transparent pixels, and pixels in the second area are transparent pixels; The first mask image is superimposed on the first image, and the pixel transparency of the target area of the first image is adjusted using transparent pixels of the second area of the first mask image to obtain a target image, wherein the target area of the target image is transparent pixels.
2. The method according to claim 1, It is characterized in that Before generating the first mask image corresponding to the first image to be processed, the method further includes: Processing pixels of a second image to generate a second mask image, wherein the second image includes a third area and a fourth area, the third area corresponds to the frame area, and the fourth area corresponds to the target area; The second mask image is superimposed on the second image, and the pixels of the third area of the second image are processed according to the area range indicated by the third area of the second mask image to obtain the first image, wherein the color pixel value of the third area of the second mask image is not 0, the color pixel value of the fourth area of the second mask image is 0, and the color pixel value is a value used to represent the pixel color.
3. The method according to claim 2, It is characterized in that Before processing the color pixels of the second image to generate the second mask image, the method further includes: generating a third image, wherein the third image is an image corresponding to the fourth area of the second image; The second image is obtained by outwardly expanding the edge of the third image, wherein an extended area formed by outwardly expanding the third image is the third area of the second image.
4. The method according to claim 1, It is characterized in that The target image corresponds to an image in the frame area, including a frame image, and the frame image is generated by processing pixels in the frame area according to preset keywords.
5. The method according to any one of claims 1 to 4, It is characterized in that The step of adjusting the pixel transparency of the target area of the first image by using the transparent pixels of the second area of the first mask image to obtain the target image includes: Acquire a first transparency pixel value of the first area and a second transparency pixel value of the second area of the first mask image, wherein the transparency pixel value is a value used to represent pixel transparency; Based on the first transparency pixel value and the second transparency pixel value, determining the target area corresponding to the second area having a transparency pixel value of 0 in the first image; The pixel transparency of the target area of the first image is adjusted to obtain the target image.
6. The method according to claim 1, It is characterized in that Before generating the first mask image corresponding to the first image to be processed, the method further includes: Receiving a target instruction input by a user, wherein the target instruction includes a first sub-instruction and a second sub-instruction; The step of generating a first mask image corresponding to the first image to be processed includes: In response to the first sub-instruction, generating a first mask image corresponding to the first image to be processed; The step of superimposing the first mask image with the first image and adjusting the pixel transparency of the target area of the first image by using the transparent pixels of the second area of the first mask image to obtain the target image includes: In response to the second sub-instruction, the first mask image is superimposed on the first image, and the pixel transparency of the target area of the first image is adjusted by using the transparent pixels of the second area of the first mask image to obtain the target image.
7. An image processing device, It is characterized in that include: A first generating module is used to generate a first mask image corresponding to a first image to be processed, wherein the first image includes a frame area and a target area located within the frame area, the first mask image includes a first area corresponding to the frame area and a second area corresponding to the target area, pixels in the first area are non-transparent pixels, and pixels in the second area are transparent pixels; An adjustment module is used to superimpose the first mask image with the first image, and use the transparent pixels of the second area of the first mask image to adjust the pixel transparency of the target area of the first image to obtain a target image, wherein the target area of the target image is a transparent pixel.
8. An electronic device, It is characterized in that include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 6 are implemented.
10. A computer program product, It is characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the image processing method according to any one of claims 1 to 6.
