Background image recommendation method and device for commodity, equipment and medium

By setting up the background image library and using the cutout algorithm and large language model to calculate the matching degree of the descriptive words, the problem of users' long time to find the background image and the mismatch between the picture is solved, and high-quality background image recommendations and AI image generation effects are achieved.

CN120067363APending Publication Date: 2025-05-30ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510108353.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, users need to spend a lot of time looking for suitable background images, and the generated pictures cannot effectively combine background images and product images, resulting in unusability.

Method used

By setting up the background image library, use the cutout algorithm to cut out the main body of the background image and the product image, and enter a large language model to obtain the descriptive words, and calculate the matching degree of the descriptive words to arrange the display background image.

Benefits of technology

This enables users to quickly find suitable background images, improves the matching degree between background images and product images, and makes the images generated by AI closer to the actual pictures, and users can directly use the generated pictures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067363A_ABST
    Figure CN120067363A_ABST
Patent Text Reader

Abstract

The invention provides a background image recommendation method and device for commodities, equipment and a medium, and the method comprises the steps: setting a background image library, carrying out the matting of a main body of each background image in the background image library through an image matting algorithm, obtaining a corresponding main body image, inputting the main body image into a large language model, obtaining a corresponding main body description word, and carrying out the recommendation of the main body description word. Enabling the main body description words to be in one-to-one correspondence with the background images, and storing the main body description words and the background images in a database; a main body of the uploaded commodity image is cut out through a cutout algorithm, a commodity cutout is obtained, the commodity cutout is input into a large language model, and commodity descriptors are obtained; calculating a matching degree between the commodity description word and each main body description word; and arranging and displaying the corresponding background images according to the sequence of the matching degrees from high to low, so that a user can quickly search the required background images for AI generation of the required images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of picture recommendation, and particularly relates to a method, device, equipment and medium for recommending background pictures for commodities. Background Art

[0002] In the prior art, a function of AI background replacement is provided. E-commerce users upload their commodity pictures, and then through the AI function, corresponding pictures with backgrounds are generated for their commodities. When users view commodity pictures in the mall, they can upload the background pictures they need at the same time. This requires users to search for the corresponding background pictures by themselves, which takes a lot of time for users to search for the corresponding background pictures. Moreover, since the background pictures uploaded by users are various, when the gap between the commodity in the background picture and the commodity in the commodity picture is too large, the generated picture may not be able to combine the background picture and the commodity picture well, resulting in the situation that the generated picture cannot be used. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for recommending background pictures for commodities, which is convenient for users to quickly search for the required background pictures for AI to generate the required pictures.

[0004] In a first aspect, the present invention provides a method for recommending background pictures for commodities, including the following steps:

[0005] Step 1: Set up a background picture library. For each background picture in the background picture library, extract its main body through a matting algorithm to obtain a corresponding main body picture. Input the main body picture into a large language model to obtain a corresponding main body description word, and store the one-to-one correspondence between the main body description word and the background in a database; Figure 1 and store it in the database;

[0006] Step 2: Extract the main body of the uploaded commodity picture through a matting algorithm to obtain a commodity matting, and input the commodity matting into a large language model to obtain a commodity description word;

[0007] Step 3: Calculate the matching degree between the commodity description word and each main body description word; arrange and display the corresponding background pictures in descending order of the matching degree.

[0008] In a second aspect, the present invention provides a device for recommending background pictures for commodities, including:

[0009] A background picture library setting module, which sets up a background picture library. For each background picture in the background picture library, extract its main body through a matting algorithm to obtain a corresponding main body picture. Input the main body picture into a large language model to obtain a corresponding main body description word, and store the one-to-one correspondence between the main body description word and the background in a database; Figure 1 and store it in the database;

[0010] A module for obtaining product description words extracts the main body of the uploaded product image through a matting algorithm to obtain a product matte, and inputs the product matte into a large language model to obtain product description words;

[0011] A matching display module calculates the matching degree between the product description words and each main body description word; and arranges and displays the corresponding background images in descending order of the matching degree.

[0012] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method described in the first aspect is implemented.

[0013] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.

[0014] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:

[0015] By setting up a background picture library, the user can upload a photo of their product, and then match the most suitable background picture according to the uploaded photo. After the user selects a background picture, it is used for AI to generate a picture, which can make the picture more matched with the background picture. Then, by uploading the background picture and the product photo to the AI, the picture generated by the AI can be closer to the actually taken picture, and the user can directly use this picture as a display picture.

[0016] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features, and advantages of the present invention more obvious and understandable, the following specifically describes the embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The present invention will be further described below with reference to the accompanying drawings in conjunction with embodiments.

[0018] Figure 1 It is a flowchart of the method in Embodiment 1 of the present invention;

[0019] Figure 2 It is a structural schematic diagram of the device in Embodiment 2 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] The general idea of the technical solution in the embodiments of the present application is as follows:

[0021] (1) Identify the main subject in the image uploaded by the user, and there will be exactly one main subject identified.

[0022] (2) Perform word segmentation on the main subject, conduct semantic analysis on the word segmentation results, and remove pure adjectives because pure adjectives have no meaning for product image recommendation. For example, if the main subject identification result is [white sneakers], the word segmentation results are [white sneakers, white, sneakers, shoes]. If the adjective [white] has meaning, it will rank content like [white table lamp], which has no relevance, at the front.

[0023] (3) Match the word segmentation results with the main subjects in the product library one by one. For a complete match, add x points; for a partial match, add y points; for a single-character match, add z points. The above scores: x > y > z. The reason for this score design is that a complete match definitely has the strongest relevance; a partial match represents a certain degree of relevance; a single-character match indicates a very weak relevance, but it needs to be ranked higher than those with no relevance at all.

[0024] (4) After accumulating all the word segmentation matching results, use it as the score of the main subject. For product images with multiple main subjects, take the highest main subject score as the product image score. Finally, calculate the score of each product image in this round of matching in the library, and sort them in reverse order according to the scores. The product image that best matches the user scenario is ranked at the front.

[0025] (5) For product images with multiple main subjects, display the main subject with the highest matching score to the user.

[0026] Suppose adding 30 points for a complete match, 10 points for a partial match, and 5 points for a single-character match.

[0027] Main subject identification result: [ceramic vase]

[0028] Main subject word segmentation results: [ceramic vase, ceramic, vase, bottle], [ceramic] belongs to an adjective and does not participate in the subsequent score calculation. Finally, the ones participating in the score calculation are [ceramic vase, vase, bottle]

[0029] Perform matching:

[0030] The main subject identification result of a certain image is: [ceramic vase];

[0031] Main subject score calculation result: Hitting [ceramic vase] adds 30 points, hitting [vase] adds 10 points, hitting [bottle] adds 5 points, and the final score is 45; Final image score calculation result: 45 points;

[0032] The main subject identification result of a certain image is: [plastic vase];

[0033] Subject scoring result: Not hitting [ceramic vase] adds 0 points, hitting [vase] adds 10 points, hitting [bottle] adds 5 points, and the final score is 15; Final picture scoring result: 15 points.

[0034] Embodiment 1

[0035] As Figure 1 shown, this embodiment provides a method for recommending background pictures for commodities, including the following steps:

[0036] Step 1: Set up a background picture library, extract the main body of each background picture in the background picture library through a matting algorithm to obtain the corresponding main body picture, input the main body picture into a large language model to obtain the corresponding main body description words, and pair the main body description words with the background Figure 1 one by one, and store them in the database;

[0037] Step 2: Extract the main body of the uploaded commodity picture through a matting algorithm to obtain a commodity matte, input the commodity matte into a large language model to obtain commodity description words;

[0038] Step 3: Calculate the matching degree between the commodity description words and each main body description word; Arrange and display the corresponding background pictures in descending order of the matching degree.

[0039] There are various pictures with commodities in this background picture library. The commodities uploaded by users can identify the corresponding background pictures in it. This background picture has a higher degree of fit with the commodity pictures uploaded by users, which is more conducive to the recognition of AI, enabling it to generate more perfect pictures.

[0040] In this embodiment, preferably, step 1 is further specifically as follows: Set up a background picture library, extract the main body of each background picture in the background picture library through a matting algorithm to obtain the corresponding main body picture, input the main body picture into a large language model to obtain the corresponding main body description words, and pair the main body description words with the background Figure 1 one by one, perform word segmentation on the main body description words through the ElasticSearch database, remove the pure adjectives among them to obtain the word segmentation result, and then store the main body description words and the word segmentation result in the ElasticSearch database;

[0041] Step 2 is further specifically as follows: Extract the main body of the uploaded commodity picture through a matting algorithm to obtain a commodity matte, input the commodity matte into a large language model to obtain commodity description words, perform word segmentation on the commodity description words through the ElasticSearch database, and remove the pure adjectives among them to obtain the commodity description word segmentation.

[0042] In this embodiment, preferably, step 3 is specifically as follows: Set matching rules. If there is a complete match, add x points; if there is a partial match, add y points; if there is a single-word match, add z points; if there is no match, add 0 points.

[0043] Calculate the matching degree of the product description words and the product description word segments with each main description word and the word segmentation result according to the set matching rules; Arrange and display the corresponding background images in descending order of the matching degree.

[0044] In this embodiment, preferably, the matting algorithm is as follows: Judge the pixels of the image. If the pixels of the image are less than 2000×2000, directly perform matting operations through the Visual Intelligence Open Platform to obtain the required main image of the picture; If the pixels of the image are greater than or equal to 2000×2000, use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to scale the image proportionally to obtain a scaled image; Perform matting operations on the scaled image through the Visual Intelligence Open Platform to obtain a first mask image; Use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to proportionally restore the first mask image to the original size to obtain a second mask image; Read the alpha channel of each pixel point in the image to obtain a first matrix, read the alpha channel of each pixel point in the second mask image to obtain a second matrix, and call Core.min to merge the first matrix and the second matrix to obtain a third matrix; Replace the alpha channel in the image with the third matrix to obtain the required main image of the picture.

[0045] Due to the matting size limit of the Alibaba Cloud Visual Intelligence Open Platform, when the longest side exceeds 2000 pixels, it is necessary to perform proportional scaling, and call Imgproc.resize with the Imgproc.INTER_LANCZOS4 algorithm to perform image scaling.

[0046] Call Imgproc.resize with the Imgproc.INTER_LANCZOS4 algorithm to perform image scaling. This algorithm can reduce the influence of artifacts while maintaining the edge sharpness.

[0047] Obtain the matting result based on the black and white image + the original image:

[0048] a. Take out the alpha channel of the original image, and call Core.min. It will take the minimum value of the transparency channels of the mask and the original image to ensure that the original information of the transparency channel is retained. Through this step of processing, the lines of the obtained matting can be made more perfect.

[0049] b. Remove the transparent channel of the original image and add the black and white image as a new transparent channel to merge the layers;

[0050] c. Set the color value of the transparent area to black. This step is to reduce the size of the cutout result image and save storage costs.

[0051] The core code is as follows:

[0052] / / Create a fully transparent matrix of the same size as the original image for comparison;

[0053] Mat compareAlpha=new Mat(outImg.size(),CvType.CV_8UC1,Scala r.all(0.0));

[0054] / / Used to save the comparison results;

[0055] Mat compareResult=newMat();

[0056] / / Compare the transparent channel and alpha of the original image, and the position where the value is 0 in the obtained mask is the transparent position in the original image;

[0057] Core.compare(outPlanes.get(3),compareAlpha,compareResult,Core.CM P_EQ);

[0058] / / Create a completely black matrix of the same size as the original image;

[0059] Matblack=newMat(outImg.size(),outImg.type(),Scalar.all(0));

[0060] / / Copy the black in black to the corresponding position of outImg according to mask;

[0061] Core.bitwise_and(black,outImg,outImg,compareResult).

[0062] Based on the same inventive concept, the present application also provides a device corresponding to the method in Example 1, see Example 2 for details.

[0063] Embodiment 2

[0064] like Figure 2 As shown, in this embodiment, a background image recommendation device for commodities is provided, comprising:

[0065] Set up a background picture library module, set up a background picture library, extract the main body of each background picture in the background picture library through a matte painting algorithm to obtain the corresponding main body picture, input the main body picture into a large language model to obtain the corresponding main body description words, and associate the main body description words with the background Figure 1 in one-to-one correspondence and store them in a database;

[0066] For the module of obtaining product description words, extract the main body of the uploaded product picture through a matte painting algorithm to obtain a product matte painting, input the product matte painting into a large language model to obtain product description words;

[0067] For the matching and display module, calculate the matching degree between the product description words and each main body description word; arrange and display the corresponding background pictures in descending order of the matching degree.

[0068] In this embodiment, preferably, the background picture library module is further specifically: set up a background picture library, extract the main body of each background picture in the background picture library through a matte painting algorithm to obtain the corresponding main body picture, input the main body picture into a large language model to obtain the corresponding main body description words, and associate the main body description words with the background Figure 1 in one-to-one correspondence, perform word segmentation on the main body description words through an ElasticSearch database, remove the pure adjectives among them to obtain a word segmentation result, and then store the main body description words and the word segmentation result in the ElasticSearch database;

[0069] The module of obtaining product description words is further specifically: extract the main body of the uploaded product picture through a matte painting algorithm to obtain a product matte painting, input the product matte painting into a large language model to obtain product description words, perform word segmentation on the product description words through an ElasticSearch database, and remove the pure adjectives among them to obtain product description word segmentation.

[0070] In this embodiment, preferably, the matching and display module is specifically: set up a matching rule, if it is a complete match, add x points; if it is a partial match, add y points; if it is a single-character match, add z points; if there is no match, add 0 points;

[0071] Calculate the matching degree between the product description words and product description word segmentation and each main body description word and word segmentation result according to the set matching rule; arrange and display the corresponding background pictures in descending order of the matching degree.

[0072] In this embodiment, preferably, the matte extraction algorithm is as follows: judge the pixels of the picture. If the pixels of the picture are less than 2000×2000, directly perform matte extraction operation through the Visual Intelligence Open Platform to obtain the required main picture of the picture; if the pixels of the picture are greater than or equal to 2000×2000, use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to scale the picture proportionally to obtain a scaled picture; perform matte extraction operation on the scaled picture through the Visual Intelligence Open Platform to obtain a first mask picture; use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to restore the first mask picture proportionally to the original size to obtain a second mask picture; read the alpha channel of each pixel point in the picture to obtain a first matrix, read the alpha channel of each pixel point in the second mask picture to obtain a second matrix, and call Core.min to merge the first matrix and the second matrix to obtain a third matrix; replace the alpha channel in the picture with the third matrix to obtain the required main picture of the picture.

[0073] Since the device introduced in the second embodiment of the present invention is the device used to implement the method in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, those skilled in the art can understand the specific structure and variations of the device, so it will not be elaborated here. Any device used to implement the method in the first embodiment of the present invention belongs to the scope of protection of the present invention.

[0074] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to the first embodiment, as detailed in the third embodiment.

[0075] Embodiment Three

[0076] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, any implementation manner in the first embodiment can be realized.

[0077] Since the electronic device introduced in this embodiment is the device used to implement the method in the first embodiment of this application, based on the method introduced in the first embodiment of this application, those skilled in the art can understand the specific implementation manners and various variations of the electronic device in this embodiment, so the details of how this electronic device implements the method in the embodiments of this application will not be introduced here in detail. Any device used by those skilled in the art to implement the method in the embodiments of this application belongs to the scope of protection of this application.

[0078] Based on the same inventive concept, this application provides a storage medium corresponding to the first embodiment, as detailed in the fourth embodiment.

[0079] Example 4

[0080] This embodiment provides a computer-readable storage medium with a computer program stored thereon. When the computer program is executed by a processor, any implementation manner in Embodiment 1 can be realized.

[0081] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0082] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for realizing the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0083] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means realizes the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0084] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0085] Although the specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments we described are illustrative rather than used to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should all be covered by the scope protected by the claims of the present invention.

Claims

1. A method for recommending a background image for a product, characterized in that: The steps include: Step 1: Set up a background image library, cut out the main body of each background image in the background image library through a cutout algorithm to obtain a corresponding main body image, input the main body image into a large language model to obtain a corresponding main body description word, correspond the main body description word to the background image one by one, and store them in a database; Step 2: Cut out the main body of the uploaded product image through a cutout algorithm to obtain a product cutout, and input the product cutout into a large language model to obtain a product description word; Step 3: Calculate the matching degree between the product description word and each subject description word; The corresponding background images are arranged and displayed in order from high to low matching degree.

2. A method for recommending background images for commodities according to claim 1, characterized in that: The step 1 is further specifically as follows: setting a background image library, cutting out the main body of each background image in the background image library through a cutting algorithm to obtain a corresponding main body image, inputting the main body image into a large language model to obtain corresponding main body description words, making a one-to-one correspondence between the main body description words and the background images, performing a segmentation operation on the main body description words through an ElasticSearch database, removing pure adjectives therein, obtaining a segmentation result, and then storing the main body description words and the segmentation result in the ElasticSearch database; The step 2 is further specifically as follows: the main body of the uploaded product image is cut out through a cutout algorithm to obtain a product cutout, the product cutout is input into a large language model to obtain a product description, the product description is segmented through an ElasticSearch database, and pure adjectives are removed therefrom to obtain a product description segmentation.

3. A method for recommending background images for commodities according to claim 2, characterized in that: The step 3 is specifically as follows: setting matching rules, if it is a complete match, add x points; if it is a partial match, add y points; if it is a single word match, add z points; if it is a non-match, add 0 points; The matching degree of the product description word and product description segmentation word with each main description word and segmentation result is calculated according to the set matching rules; and the corresponding background images are arranged and displayed in order from high to low matching degree.

4. The method for recommending a background image for a product according to claim 1, characterized in that: The cutout algorithm is as follows: the pixels of the image are judged. If the pixels of the image are less than 2000×2000, the cutout operation is directly performed through the visual intelligent open platform to obtain the required main image of the image; if the pixels of the image are greater than or equal to 2000×2000, the image is scaled in proportion using the Imgproc.resize in OpenCV and the Imgproc.INTER_LANCZ0S4 algorithm to obtain a scaled image; the scaled image is cutout through the visual intelligent open platform to obtain a first mask image; the first mask image is proportionally restored to a second mask image of the original size through the Imgproc.resize in OpenCV and the Imgproc.INTER_LANCZ0S4 algorithm; the transparent channel of each pixel in the image is read out to obtain a first matrix, the transparent channel of each pixel in the second mask image is read out to obtain a second matrix, and Core.min is called to merge the first matrix with the second matrix to obtain a third matrix; The transparent channel in the picture is replaced by the third matrix to obtain the desired main image of the picture.

5. A background image recommendation device for commodities, characterized in that: include: Setting a background image library module, setting a background image library, cutting out the main body of each background image in the background image library through a cutting algorithm to obtain a corresponding main body image, inputting the main body image into a large language model to obtain a corresponding main body description word, making a one-to-one correspondence between the main body description word and the background image, and storing them in a database; A module for obtaining product description words is used to cut out the main body of the uploaded product image through a cutout algorithm to obtain a product cutout image, and the product cutout image is input into a large language model to obtain a product description word; A matching display module calculates the matching degree between the product description word and each subject description word; The corresponding background images are arranged and displayed in order from high to low matching degree.

6. The background image recommendation device for commodities according to claim 5, characterized in that: The module for setting a background image library is further specifically as follows: setting a background image library, cutting out the main body of each background image in the background image library through a cutting algorithm to obtain a corresponding main body image, inputting the main body image into a large language model to obtain a corresponding main body description word, making a one-to-one correspondence between the main body description word and the background image, and performing a word segmentation operation on the main body description word through an ElasticSearch database, removing pure adjectives therein, obtaining a word segmentation result, and then storing the main body description word and the word segmentation result in the ElasticSearch database; The module for obtaining product description words is further specifically as follows: the main body of the uploaded product image is cut out through a cutout algorithm to obtain a product cutout, the product cutout is input into a large language model to obtain product description words, the product description words are segmented through an ElasticSearch database, and pure adjectives therein are removed to obtain product description segmented words.

7. The background image recommendation device for commodities according to claim 6, characterized in that: The matching display module specifically includes: setting matching rules, if it is a complete match, add x points; if it is a partial match, add y points; if it is a single word match, add z points; if it is a non-match, add 0 points; The matching degree of the product description word and product description segmentation word with each main description word and segmentation result is calculated according to the set matching rules; and the corresponding background images are arranged and displayed in order from high to low matching degree.

8. The background image recommendation device for commodities according to claim 5, characterized in that: The cutout algorithm is as follows: the pixels of the image are judged. If the pixels of the image are less than 2000×2000, the cutout operation is directly performed through the visual intelligent open platform to obtain the required main image of the image; if the pixels of the image are greater than or equal to 2000×2000, the image is scaled in proportion using the Imgproc.resize in OpenCV and the Imgproc.INTER_LANCZ0S4 algorithm to obtain a scaled image; the scaled image is cutout through the visual intelligent open platform to obtain a first mask image; the first mask image is proportionally restored to a second mask image of the original size through the Imgproc.resize in OpenCV and the Imgproc.INTER_LANCZ0S4 algorithm; the transparent channel of each pixel in the image is read out to obtain a first matrix, the transparent channel of each pixel in the second mask image is read out to obtain a second matrix, and Core.min is called to merge the first matrix with the second matrix to obtain a third matrix; The transparent channel in the picture is replaced by the third matrix to obtain the desired main image of the picture.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.