Image generation method and device, electronic equipment and storage medium

By compressing the initial image and adjusting it on the terminal device, the problems of slow product image generation and poor quality are solved, and efficient generation of high-quality synthetic images is achieved.

CN120833409APending Publication Date: 2025-10-24BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410501236.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-24
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

In the existing technology, product images are generated slowly and the image quality is poor, especially during promotional activities on e-commerce platforms when the server load is too high, resulting in slow generation speed or poor image quality.

Method used

By compressing the initial image, a second initial image with a smaller data volume is generated, and the outline of the target object is identified in the cloud. After receiving the initial mask image, adjustments are made on the terminal device to generate a corrected mask image, and finally a composite image is generated locally. The image quality is improved by combining the adjustment instructions input by the user.

Benefits of technology

It reduces the amount of data processing in the cloud, shortens the image processing time, and improves the quality and generation speed of synthetic images, meeting the e-commerce platform's demand for product image display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120833409A_ABST
    Figure CN120833409A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image generation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a first initial image, carrying out the compression processing of the first initial image, obtaining a second initial image, and enabling the data volume of the second initial image to be smaller than the data volume of the first initial image; the second initial image is sent to the cloud, an initial mask image returned by the cloud is received, and the initial mask image is used for indicating a second contour of the target object in the second initial image; and in response to an adjustment instruction for the initial mask image, generating a corrected mask image, and based on the corrected mask image, generating a composite image. The compressed initial image is sent to the cloud to be processed, the corresponding initial mask image is obtained, the corrected mask image is generated in combination with the adjustment instruction, and finally the synthetic image is generated based on the corrected mask image, so that the data processing amount of the cloud is reduced, and the time consumption of the image processing process is shortened; and the image quality of the generated composite image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to the technical field of image processing, and particularly relate to an image generation method and device, electronic equipment and storage medium. BACKGROUND

[0002] Currently, in the scenario of e-commerce commodity image creation, the platform helps users to generate corresponding commodity images in batches by providing the function of automatically generating commodity images to the users, thereby solving the problem of low efficiency caused by manual production of commodity images by the users.

[0003] The commodity image generation scheme in the prior art is usually to send an original product photo from a terminal to a server, and then return the finally generated commodity image to the terminal for display or input after the server is processed.

[0004] However, in the above scheme in the prior art, there are problems of slow generation speed of commodity images and poor image effect. SUMMARY

[0005] Embodiments of the present disclosure provide an image generation method and device, electronic equipment and storage medium to overcome the problem of slow generation speed of commodity images and poor image effect.

[0006] In a first aspect, the embodiments of the present disclosure provide an image generation method, comprising:

[0007] obtaining a first initial image and performing compression processing on the first initial image to obtain a second initial image, the data volume of the second initial image being smaller than the data volume of the first initial image; sending the second initial image to a cloud and receiving an initial mask image returned by the cloud, the initial mask image being used to indicate a second contour of a target object in the second initial image; generating a corrected mask image in response to an adjustment instruction for the initial mask image, wherein the corrected mask image is used to indicate a first contour of a target object in the first initial image; and generating a composite image based on the corrected mask image, the composite image containing a target object segmented based on the first contour.

[0008] In a second aspect, the embodiments of the present disclosure provide an image generation device, comprising:

[0009] a compression module configured to obtain a first initial image and perform compression processing on the first initial image to obtain a second initial image, the data volume of the second initial image being smaller than the data volume of the first initial image;

[0010] a transceiver module configured to send the second initial image to a cloud and receive an initial mask image returned by the cloud, the initial mask image being used to indicate a second contour of a target object in the second initial image; and

[0011] a correction module configured to generate a correction mask image in response to an adjustment instruction for the initial mask image, wherein the correction mask image is used to indicate a first contour of a target object in the first initial image;

[0012] a generation module configured to generate a composite image based on the correction mask image, wherein the composite image contains the target object segmented based on the first contour.

[0013] In a third aspect, an electronic device is provided, and the electronic device includes a processor and a memory.

[0014] The memory stores computer-executable instructions.

[0015] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the image generation method according to the first aspect and various possible designs of the first aspect.

[0016] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the image generation method according to the first aspect and various possible designs of the first aspect is implemented.

[0017] In a fifth aspect, a computer program product is provided, and the computer program product includes a computer program. When a processor executes the computer program, the image generation method according to the first aspect and various possible designs of the first aspect is implemented.

[0018] The image generation method, device, electronic device and storage medium provided in this embodiment obtain a first initial image and compress the first initial image to obtain a second initial image, wherein the data volume of the second initial image is smaller than the data volume of the first initial image; send the second initial image to the cloud, and receive an initial mask image returned by the cloud, wherein the initial mask image is used to indicate the second contour of the target object in the second initial image; generate a corrected mask image in response to an adjustment instruction for the initial mask image, wherein the corrected mask image is used to indicate the first contour of the target object in the first initial image; and generate a composite image based on the corrected mask image, wherein the composite image includes the target object segmented based on the first contour. By sending the compressed initial image to the cloud for processing, the corresponding initial mask image is obtained, and then the initial mask image is adjusted in combination with the adjustment instructions input by the user to generate a corrected mask image. Finally, based on the outline of the target object indicated by the corrected mask image, the process of clipping the target object in the image and generating a synthetic image is completed. By combining the end and the cloud, the data processing volume on the cloud is reduced, the time consumption of the image processing process is shortened, and the adjusted corrected mask image is used to accurately segment the target object and improve the image quality of the generated synthetic image. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0020] Figure 1 A diagram of an application scenario of the image generation method provided in an embodiment of the present disclosure;

[0021] Figure 2 Schematic diagram of the process of the image generation method provided in the embodiment of the present disclosure Figure 1 ;

[0022] Figure 3 for Figure 2 A flowchart of specific implementation steps of step S104 in the embodiment shown;

[0023] Figure 4 for Figure 3 A flowchart of specific implementation steps of step S1042 in the embodiment shown;

[0024] Figure 5 A schematic diagram of a process for generating a composite image provided by an embodiment of the present disclosure;

[0025] Figure 6 A flowchart of an image generation method provided by an embodiment of the present disclosure is shown in Figure 2 ;

[0026] Figure 7 A flowchart of the specific implementation steps of step S203 in the embodiment shown in Figure 6

[0027] Figure 8 A flowchart of the specific implementation steps of step S203A in the embodiment shown in Figure 6

[0028] Figure 9 A flowchart of the specific implementation steps of step S207 in the embodiment shown in Figure 6

[0029] A flowchart of a process of generating a correction mask image provided by an embodiment of the present disclosure is shown in Figure 10

[0030] A structural block diagram of an image generation device provided by an embodiment of the present disclosure is shown in Figure 11

[0031] A structural diagram of an electronic device provided by an embodiment of the present disclosure is shown in Figure 12

[0032] A hardware structural diagram of an electronic device provided by an embodiment of the present disclosure is shown in Figure 13 DETAILED DESCRIPTION

[0033] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the protection scope of the present disclosure.

[0034] It should 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 for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0035] The application scenarios of the embodiments of the present disclosure are explained as follows:

[0036] ​​​Figure 1 An application scenario diagram of the image generation method provided by the embodiments of the present disclosure is provided. The image generation method provided by the embodiments of the present disclosure can be applied to an application (APP, Application) having an image generation function, such as a merchant-side program of a shopping software. More specifically, it can be applied to an application scenario of generating a product image. The execution subject of the present embodiment can be a terminal device running the above-mentioned application having an image generation function, or a server deploying a server corresponding to the above-mentioned application, or other electronic devices having similar functions.

[0037] In some embodiments, the terminal device or the server can implement the image generation method provided by the embodiments of the present disclosure by running various computer executable instructions or computer programs. For example, the computer executable instructions can be program-level commands, machine instructions or software instructions. The computer program can be a native program in the operating system or a software module; it can be a local application program, that is, a program that needs to be installed in the operating system to run, or a small program embedded in any APP, that is, a program running based on a browser environment. In summary, the above-mentioned computer executable instructions can be any form of instructions, and the above-mentioned computer programs can be any form of application programs, modules or plug-ins, and the specific implementation form can be configured as needed. Further, in some embodiments, the server can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud storage, cloud communication, cloud database, cloud computing, cloud function, network service, middleware service, domain name service, security service, content distribution network (CDN), and big data and artificial intelligence platform, etc. Basic cloud computing services, wherein the cloud service can be an interactive processing service for calling by the terminal device.

[0038] Reference Figure 1 As shown in FIG. 1, in the application scenario of generating a product image, the terminal device runs, for example, a merchant-side application program (hereinafter referred to as an application program), sends the photographed product original image to the server through the application program, and generates a product image having promotional information (such as the content of “pre-sale price XX” and “pre-sale date XXX” in the figure) of product selling points and product prices after processing the product original image by the server, and sends it to the terminal device for display in the application program on the terminal device side, thereby completing the process of automatically generating a product image.

[0039] In the prior art, in the application scenario of generating a product image applied to an e-commerce platform, a (seller) user sends a product original image taken by the user to a server, and the server generates a product image with a certain format and effect through unified processing, to meet the display requirements of the e-commerce platform for the product image. However, in actual application, during a promotion activity on the e-commerce platform, there will be a large number of product image generation requirements, which will cause the server load to be too high, and thus the product image generation request submitted by the user from the terminal cannot be responded for a long time, resulting in a slow product image generation speed. Alternatively, in order to shorten the time consumed by the server side for generating the product image, the precision of image processing by the server can only be reduced, resulting in a poor image effect of the generated product image.

[0040] The embodiment of the present disclosure provides an image generation method to solve the above problems.

[0041] Reference Figure 2 , Figure 2 The flowchart of the image generation method provided by the embodiment of the present disclosure is shown in Figure 1 The method of the embodiment can be applied in a terminal device. The image generation method comprises the following steps.

[0042] Step S101: Obtain a first initial image, and perform compression processing on the first initial image to obtain a second initial image. The data volume of the second initial image is smaller than that of the first initial image.

[0043] For example, referring to the application scenario diagram shown in Figure 1 The terminal device loads a product original image taken by a user, i.e., a first initial image, by running an application scenario. The first initial image contains an object as a product element, i.e., a target object. In a specific embodiment, the content of the first initial image is "a mobile phone placed on a table", and the target object in the first initial image is the "mobile phone" in the first initial image. The execution purpose of the image generation method provided by the embodiment is to generate a product image for the "mobile phone", i.e., a composite image generated in the subsequent steps.

[0044] After obtaining the first initial image, the terminal device first compresses the first initial image to obtain a second initial image with a smaller data volume. The implementation method of compressing the first initial image to obtain the second initial image with a smaller data volume includes, for example, reducing the resolution of the first initial image to obtain a second initial image with a lower resolution; or cropping the first initial image to obtain a second initial image containing only an image region related to the target object; or degrading the image color of the first initial image to obtain a second initial image represented by a gray value. After the compression processing step of any one or more of the above, the data volume of the obtained second initial image is smaller than that of the first initial image.

[0045] Step S102: sending the second initial image to the cloud and receiving an initial mask image returned by the cloud, the initial mask image being used to indicate a second contour of the target object in the second initial image.

[0046] Exemplarily, after obtaining the compressed second initial image, the terminal device sends the second initial image to the cloud, i.e. Figure 1 the server in the application scenario shown, and the cloud processes the second initial image to obtain an initial mask image representing the contour of the target object. Specifically, the initial mask image has the same size as the second initial image and is composed of “0” values and “1” values. The pixel point position corresponding to the “1” value is the position of the target object in the second initial image, and the pixel point position corresponding to the “0” value is the position of the background of the target object in the second initial image, i.e., the non-target object. The “1” value constitutes the edge of the region, i.e., the contour of the target object in the second initial image, i.e., the second contour.

[0047] The process of generating the initial mask image representing the contour of the target object by the cloud based on the recognition of the target object in the second initial image is a prior art, and will not be described in detail. However, it should be noted that the second initial image is a compressed image of the first initial image, for example, the second initial image has a lower resolution and a smaller number of color channels than the first initial image. Therefore, the accuracy of the second contour is poorer than that of the first contour (which can be understood as the actual contour of the target object) of the target object in the first initial image, i.e., the initial mask image is relatively rough. On the other hand, since the data volume of the second initial image generated after compression is smaller than that of the first initial image, the cloud uses fewer computing resources and network resources when processing the second initial image, and therefore the time consumed for generating the initial mask image is shorter.

[0048] In the second initial image, the contour of the target object is a first contour. The first contour can be different from the second contour due to the compression of the second initial image. Specifically, the terminal device sends an image processing request to the cloud, where the image processing request includes the compressed second initial image. The cloud responds to the image processing request by identifying the target object in the second initial image and generating an initial mask image representing the contour of the target object. However, the initial mask image can only indicate the second contour of the target object in the second initial image, which is different from the first contour of the target object in the first initial image.

[0049] Step S103: In response to the adjustment instruction for the initial mask image, a corrected mask image is generated, where the corrected mask image is used to indicate the first contour of the target object in the first initial image.

[0050] Step S104: Based on the corrected mask image, a composite image is generated, where the composite image includes the target object segmented based on the first contour.

[0051] After that, the terminal device can superimpose the initial mask image on the first initial image or the second initial image to display the second contour described by the initial mask image. Based on the above description, the second contour described by the initial mask image is a rough contour generated based on the second initial image. To improve the accuracy of subsequent segmentation of the target object, the terminal device can receive an adjustment instruction input by a user to adjust the initial mask image to obtain a corrected mask image indicating a contour closer to the real contour of the target object (i.e., the first contour). Then, the terminal device can segment the first initial image stored locally based on the corrected mask image to obtain a target object image segmented based on the first contour, and paste the target object image into a blank background image or a pre-generated background image with specific content to generate a composite image.

[0052] In one possible implementation, as shown in Figure 3 the specific implementation steps of step S104 include:

[0053] Step S1041: Obtain feature description information of the background image, where the feature description information is used to represent the image content features of the background image.

[0054] Step S1042: Generate the background image based on the feature description information.

[0055] Step S1043: Cut the target object from the first initial image based on the modified mask image, and overlay the target object to the corresponding position in the background image to generate a composite image.

[0056] Exemplarily, for the case of generating a background image of specific content, the terminal device first acquires feature description information of the background image, which is used to represent the image content features of the background image. Specifically, in one possible implementation, the feature description information can include a picture ID, a picture classification number, and the like, which are description identifiers for indicating a specific numbered or specific type of picture. The terminal device acquires a specific picture corresponding to the description identifier as the background image, or acquires a specific type of picture and randomly acquires a specific picture from the specific type of picture as the background image. In another possible implementation, the feature description information can include a descriptive text, which is used as a prompt word to call an image generation model to generate the background image. Then, based on the position of the first contour indicated by the modified mask image, the corresponding target object is cut from the first initial image and overlaid to the corresponding position in the background image generated by the above steps, and a composite image is generated.

[0057] In the steps of this embodiment, the background image with specific image content features is generated through the feature description information, thereby realizing dynamic on-demand generation of the background image. The feature description information can integrate the display requirements of the goods into the background image, generate a background image that meets the display requirements of the goods, and further improve the image quality and visual effect of the finally generated composite image, so that the composite image has better product promotion effect as a product image.

[0058] Further, as shown in Figure 4 the specific implementation steps of step S1042 include:

[0059] Step S1042A: Generate a feature complexity according to the feature description information, and the feature complexity is the complexity of the image elements in the background image.

[0060] Step S1042B: Determine a target processing end according to the feature complexity, and the target processing end is a terminal or a cloud end.

[0061] Step S1042C: Call an image generation model of the target processing end to process the feature description information to obtain a background image.

[0062] Exemplarily, in the embodiment, in the process of generating the background image, first, the corresponding feature complexity is generated according to the feature description information, which can be represented by a complexity identifier or a complexity value. The complexity identifier or the complexity value represents the level of complexity, for example, the earlier the complexity identifier is sorted, or the larger the complexity value is, the higher the complexity of the graphical element is, and vice versa. Further, the feature complexity is positively correlated with the generation difficulty of the image element in the background image, that is, the higher the feature complexity is, the greater the generation difficulty of the image element is. In the step of the embodiment, based on the feature complexity, a target processing end matched therewith is determined, wherein the target processing end is a terminal or a cloud end. The terminal is the terminal device referred to in the embodiment, and the execution subject of the method of the embodiment. When the feature complexity is large, the image generation model of the cloud end is called to generate the corresponding background image, so as to ensure the generation quality of the image. When the feature complexity is small, the image generation model of the local terminal is called to generate the corresponding background image, so as to quickly generate the background image and reduce the resource consumption of the cloud end, thereby improving the comprehensive generation efficiency and image quality of the background image.

[0063] Figure 5 A process schematic diagram for generating a synthetic image provided by the embodiment of the present disclosure is shown below. Figure 5 Further introduction is made to the above process, as shown in Figure 5 Exemplarily, first, the terminal device acquires a first initial image P1, and generates a second initial image P2 after compressing the first initial image P1. Then, the terminal device sends the second initial image P2 to the server (i.e., the cloud end), and generates an initial mask image M1 after processing the second initial image P2 by the server, and sends the initial mask image M1 back to the terminal device. After that, the terminal device generates a corrected mask image M2 by adjusting the initial mask image M1 based on the adjustment instruction input by the user. Finally, the terminal device generates a synthetic image P5 by pasting the target object map P3 obtained by cutting the first initial image P1 to the pre-generated background image P4 (refer to the application scenario diagram shown in Figure 1 .

[0064] With reference to the introduction of the application scenario corresponding to the present embodiment, due to the computing resources possessed by the terminal device, the accurate recognition model usually needs to be deployed on the cloud server to achieve the required object recognition effect. However, at the same time, it causes the problem of large server resource consumption. In the present embodiment, by compressing the first initial resource to generate a second initial resource, and only using the cloud to perform object recognition on the second initial resource to generate a mask image, other image processing tasks such as image compression, image segmentation, and image synthesis are offloaded to the terminal side for execution, which greatly reduces the computing resource and network resource consumption of the cloud, improves the image processing speed of the cloud, and at the same time, through manual correction of the initial mask image generated by the cloud on the terminal side, the contour positioning accuracy of the target object is improved, and the purpose of improving the image processing speed and the image quality of the synthesized image at the same time is ultimately achieved.

[0065] In the present embodiment, by obtaining a first initial image and compressing the first initial image to obtain a second initial image, the data volume of the second initial image is smaller than that of the first initial image; the second initial image is sent to the cloud, and an initial mask image returned by the cloud is received, the initial mask image being used to indicate a second contour of a target object in the second initial image; in response to an adjustment instruction for the initial mask image, a corrected mask image is generated, wherein the corrected mask image is used to indicate a first contour of the target object in the first initial image; based on the corrected mask image, a synthesized image is generated, and the synthesized image contains a target object segmented based on the first contour. By sending the compressed initial image to the cloud for processing to obtain the corresponding initial mask image, and then adjusting the initial mask image based on the user input adjustment instruction to generate the corrected mask image, and finally completing the process of cutting out the target object in the image and generating the synthesized image based on the contour of the target object indicated by the corrected mask image, the end-cloud combination is used to reduce the data processing amount of the cloud and shorten the time consumption of the image processing process. At the same time, the corrected mask image obtained after adjustment is used to accurately segment the target object and improve the image quality of the generated synthesized image.

[0066] Reference Figure 6 , Figure 6 Flowchart of the image generation method provided by the present embodiment Figure 2 The present embodiment is based on the embodiment shown in Figure 2 The image generation method comprises:

[0067] Step S201: obtaining a first initial image.

[0068] Step S202: obtaining first configuration information, the first configuration information representing a starting state of an image preview function, the image preview function being used to display a synthesis effect image based on a second initial image before a final synthesis image is generated.

[0069] Step S203: determining a target compression model for compressing the first initial image according to the first configuration information.

[0070] Exemplarily, the first configuration information can be information configured in advance in the terminal device based on a user operation, which is used to set a running parameter when the application is running. Specifically, when an information field corresponding to the image preview function of the application in the first configuration information is set to a target value (for example, set to 1), the image preview function of the application is turned on; otherwise, the image preview function is turned off. Wherein, the image preview function is a function of previewing a synthesis effect image generated in an intermediate processing process before a final synthesis image is generated in the running process of the application with image generation function. For example, after the image preview function is turned on, the application will display a second initial image generated based on the first initial image in a preview window of the application after the first initial image is loaded. After the terminal device receives the initial mask image and generates the corrected mask image, the terminal device will also display the second initial image (i.e., a part of the second initial image) fused with the initial mask image and the corrected mask image in the preview window. The image preview function is a common function in the application with image generation function, which will not be described in detail this time.

[0071] After that, the terminal device determines different compression models for compressing the first initial image in the case of starting the image preview function and not starting the image preview function according to the first configuration information. In one possible implementation, in the case of starting the image preview function, since it is necessary to ensure the visual effect of the synthesis effect image, only the first initial image is compressed by reducing the resolution; while in the case of not starting the image preview function, the first initial image is compressed by more other types, so as to further reduce the data volume of the generated second initial image, and further reduce the cloud computing resource overhead.

[0072] Exemplarily, as shown in Figure 7 the specific implementation steps of step S203 include:

[0073] Step S2031: obtaining a first information field in the first configuration information, the first information field being used to indicate the starting state of the image preview function.

[0074] Step S2032: If the field value of the first information field is the first identifier representing that the image preview function is in the open state, a first type of compression model is determined as the target compression model, wherein the first type of compression model is at least used to reduce the image resolution of an image input into the first type of compression model.

[0075] Step S2033: If the field value of the first information field is the second identifier representing that the image preview function is in the closed state, a second type of compression model is determined as the target compression model, wherein the second type of compression model is at least used to reduce the number of color channels of an image input into the first type of compression model.

[0076] Illustratively, based on the introduction in the previous steps, by reading the field value of the first information field in the first configuration information, the starting state of the image preview function can be obtained. Then, if the field value of the first information field is the first identifier representing that the image preview function is open, for example, 1, the first type of compression model is determined as the target compression model, which can reduce the data volume of the second initial image on the one hand, and can ensure that the composite effect image based on the second initial image can show the main content in the first initial image. If the field value of the first information field is the second identifier representing that the image preview function is in the closed state, for example, 0, the second type of compression model is determined as the target compression model, wherein the second type of compression model is at least used to reduce the number of color channels of an image input into the first type of compression model. Specifically, the second type of compression model will convert an RGB image into a grayscale image, thereby reducing the data volume of the image. On this basis, the second type of compression model can further perform the function of the first type of compression model, i.e., reducing the image resolution of an image input into the model, thereby further reducing the data volume of the second initial image.

[0077] In the steps of the present embodiment, by determining the target compression model used subsequently to compress the first initial image based on the first configuration information, the image compression rate is further improved, and the resource load in the process of processing the second initial image in the cloud is reduced.

[0078] Optionally, in a possible implementation, after step S201, the method further includes:

[0079] Step S202A: Obtain second configuration information, wherein the second configuration information is used to represent the available device resources of the terminal.

[0080] Exemplarily, in the process of determining the target compression model, the available device resources of the terminal device are further combined in the embodiment, including available computing resources, such as CPU utilization, available memory amount, and available network resources, such as residual network bandwidth, and the like. Thus, the compression model matched with the available device resources is further selected, for example, the higher the CPU utilization and the less the available memory, the simpler the structure of the determined target compression model, that is, the less the available computing resources required for running the target compression model; for another example, the less the residual network bandwidth, the stronger the compression capability of the determined target compression model, so as to further reduce the volume of the generated second initial image and improve the data transmission speed of the second initial image to the cloud.

[0081] Correspondingly, in this possible implementation manner, the specific implementation manner of step S203 includes:

[0082] Step S203A: determining, according to the first configuration information and the second configuration information, a target compression model used for compressing the first initial image.

[0083] Exemplarily, after determining the specific model type based on the first configuration information, the target compression model matched with the available computing resources and / or available network resources is selected from the specific model type based on the second configuration information.

[0084] Exemplarily, as shown in Figure 8 the specific implementation manner of step S203A includes:

[0085] Step S203A-1: determining, according to the first configuration information, a target category of compression model, the target category of compression model including at least two compression models to be selected.

[0086] Step S203A-2: determining, according to the field value of the second information field and / or the third information field of the second configuration information, a target compression model matched with the available computing resources and / or available network resources from the target category of compression model.

[0087] Step S204: performing compression processing on the first initial image based on the target compression model, to obtain a second initial image, the data volume of the second initial image being less than that of the first initial image.

[0088] Exemplarily, in this embodiment, by first selecting the target category of the compression model matching the user's use demand based on the first configuration information, for example, the first type of compression model (the compression model for reducing the resolution) and the second type of compression model (the compression model for reducing the number of color channels) introduced in the above embodiments, on this basis, further selecting the target compression model matching the available resources of the device according to the second configuration information, thereby realizing the compression model matching in combination with multiple dimensions such as user intention, network environment, and model capability, and further improving the quality and efficiency of compressing the first initial image.

[0089] Step S205: sending the second initial image to the cloud and receiving the initial mask image returned by the cloud, the initial mask image being used to indicate the second contour of the target object in the second initial image.

[0090] Step S206: generating a first contour map based on the initial mask image, the first contour map including contour line segments constituting the first contour.

[0091] Step S207: in response to the adjustment instruction for the contour line segment in the first contour map, adjusting the line segment end point of the contour line segment from the first coordinate to the second coordinate, and generating a second contour map.

[0092] Step S208: generating a corrected mask image based on the second contour map.

[0093] Exemplarily, after the terminal device receives the initial mask image, since the initial mask image is generated based on the compressed second initial image, there may be a certain deviation between the contour described by the initial mask image and the real contour of the target object. In this embodiment, the terminal device generates a corresponding first contour map through the initial mask image, the first contour map including contour line segments constituting the first contour. Specifically, the first contour map can be generated based on the outermost "1" value in the initial mask image, that is, based on the pixel position set corresponding to all "1" values adjacent to "0" values in the initial mask image. More specifically, in one possible implementation, the pixel position set corresponding to all "1" values adjacent to "0" values in the initial mask image is obtained, and then the position points in the above pixel position set are down-sampled, for example, every N rows or M columns, N and M being integers greater than 1. A key position point is collected, and then the connecting line of the key position point is taken as the first contour map. The connecting line of each two adjacent key position points is a contour line segment, and the first contour map includes a plurality of contour line segments connected in sequence.

[0094] Furthermore, upon receiving the adjustment instruction for the contour segment, the terminal device adjusts the position of the contour segment's endpoints, i.e., adjusts the contour segment's endpoints from the first coordinate to the second coordinate, thereby adjusting the position of the contour segment and generating a new contour image, i.e., the second contour image. After the second contour image is generated, the contour described by the second contour image is filled with a value of "1" to restore the corresponding mask image, i.e., the corrected mask image.

[0095] In a possible implementation, the adjustment instruction includes a first adjustment instruction and a second adjustment instruction, such as Figure 9 As shown, the specific implementation of step S207 includes:

[0096] Step S2071 : In response to a first adjustment instruction for a contour line segment in the first contour image, split at least one contour line segment into at least two sub-contour line segments.

[0097] Step S2072: In response to the second adjustment instruction for the sub-contour line segments, the endpoints of two adjacent sub-contour line segments are adjusted from the first coordinates to the second coordinates to generate a second contour map.

[0098] In another possible implementation, the adjustment instruction is used to trigger two sub-adjustment steps, respectively dividing and adjusting the contour segments, wherein the first adjustment instruction is used to divide the existing contour segments in the first contour map into at least two sub-contour segments; and the first adjustment instruction is used to adjust the segment endpoints of the sub-contour segments, thereby achieving more refined contour adjustment, making the generated second contour map closer to the contour of the real target object, thereby improving the accuracy of image segmentation.

[0099] Figure 10 A schematic diagram of a process for generating a corrected mask image provided by an embodiment of the present disclosure is shown in FIG. Figure 10 As shown, the terminal device first performs edge recognition based on pixel locations with "1" values ​​in the initial mask image to generate a first contour map. Then, based on a first adjustment instruction input by the user, the contour segment L1 in the first contour map is split into sub-contour segments L1_1 and L1_2. Then, based on a second adjustment instruction input by the user, the common endpoint of sub-contour segments L1_1 and L1_2 is adjusted from coordinates P1 to P2, forming a second contour map. The second contour map is then filled with "1" values ​​to generate a revised mask image.

[0100] In the steps of this embodiment, the first adjustment instruction and the second adjustment instruction are used to achieve flexible segmentation and interruption of the contour line segments, thereby improving the accuracy of the first contour of the target object represented by the corrected mask image, and further improving the image quality of the finally generated composite image.

[0101] Step S209: generating a synthesis image based on the modified mask image, the synthesis image containing the target object segmented based on the first contour.

[0102] In this embodiment, the implementation manners of steps S201, S205, and S209 are the same as those of steps S101, S102, and S104 in the embodiment shown in FIG. 1, and thus are not described herein again. Figure 2 The implementation manners of steps S101, S102, and S104 in the embodiment shown in FIG. 1 are the same as those of steps S201, S205, and S209 in the embodiment shown in FIG. 2, and thus are not described herein again.

[0103] Corresponding to the image generation method of the above embodiment, Figure 11 A structural block diagram of an image generation apparatus provided by an embodiment of the present disclosure is shown in FIG. 3. The method introduced in the above embodiment can be executed by the image generation apparatus. The apparatus can be implemented in a software and / or hardware manner, and can be integrated in an electronic device having a certain data processing function. The electronic device can include, but is not limited to, a mobile terminal having a large data processing capability, and a desktop computer, a supercomputer, and other fixed terminals having a large data processing capability.

[0104] For ease of illustration, only parts related to the embodiments of the present disclosure are shown. For parts not related to the embodiments of the present disclosure, refer to the description of the prior art. Figure 11 The image generation apparatus 3 includes:

[0105] The compression module 31 is configured to acquire a first initial image, and perform compression processing on the first initial image to obtain a second initial image. The data volume of the second initial image is smaller than that of the first initial image.

[0106] The transceiver module 32 is configured to send the second initial image to the cloud, and receive an initial mask image returned by the cloud. The initial mask image is used to indicate a second contour of a target object in the second initial image.

[0107] The modification module 33 is configured to generate a modified mask image in response to an adjustment instruction for the initial mask image. The modified mask image is used to indicate a first contour of the target object in the first initial image.

[0108] The generation module 34 is configured to generate a synthesis image based on the modified mask image. The synthesis image contains the target object segmented based on the first contour.

[0109] According to one or more embodiments of the present disclosure, the compression module 31 is further configured to acquire first configuration information. The first configuration information represents a start state of an image preview function. The image preview function is used to display a synthesis effect diagram based on the second initial image on the terminal before the synthesis image is generated. The compression module 31 is further configured to determine a target compression model used to compress the first initial image according to the first configuration information.

[0110] According to one or more embodiments of the present disclosure, the compression module 31 is specifically configured to: acquire a first information field in the first configuration information, the first information field being used to indicate a starting state of the image preview function; determine the first type of compression model as the target compression model if a field value of the first information field is a first identifier representing that the image preview function is in an open state, wherein the first type of compression model is used to at least reduce an image resolution of an image input into the first type of compression model; and determine the second type of compression model as the target compression model if the field value of the first information field is a second identifier representing that the image preview function is in a closed state, wherein the second type of compression model is used to at least reduce a color channel number of an image input into the second type of compression model.

[0111] According to one or more embodiments of the present disclosure, the compression module 31 is further configured to: acquire second configuration information, the second configuration information being used to represent available device resources of the terminal; and in determining the target compression model for compressing the first initial image according to the first configuration information, the compression module 31 is specifically configured to: determine the target compression model for compressing the first initial image according to the first configuration information and the second configuration information.

[0112] According to one or more embodiments of the present disclosure, the second configuration information includes a second information field and / or a third information field, a field value of the second information field representing available computing resources of the terminal, and a field value of the third information field representing available network resources of the terminal; and in determining the target compression model for compressing the first initial image according to the first configuration information and the second configuration information, the compression module 31 is specifically configured to: determine a target type of compression model according to the first configuration information, the target type of compression model including at least two candidate compression models; and determine the target compression model matching the available computing resources and / or the available network resources from the target type of compression model according to the field value of the second information field and / or the third information field of the second configuration information.

[0113] According to one or more embodiments of the present disclosure, the correction module 33 is specifically configured to: generate a first contour map based on the initial mask image, the first contour map including contour line segments constituting a first contour; generate a second contour map by adjusting a line segment endpoint of a contour line segment in the first contour map from a first coordinate to a second coordinate in response to an adjustment instruction for the contour line segment; and generate a corrected mask image based on the second contour map.

[0114] According to one or more embodiments of the present disclosure, the adjustment instruction comprises a first adjustment instruction and a second adjustment instruction, and the correction module 33, when generating the second contour map by adjusting the line segment endpoints of the contour line segments in the first contour map from the first coordinates to the second coordinates in response to the adjustment instruction, is specifically configured to: segment at least one contour line segment into at least two sub-contour line segments in response to the first adjustment instruction for the contour line segment in the first contour map; and adjust the line segment endpoints of the two adjacent sub-contour line segments from the first coordinates to the second coordinates in response to the second adjustment instruction for the sub-contour line segment, to generate the second contour map.

[0115] According to one or more embodiments of the present disclosure, the generation module 34 is specifically configured to: obtain feature description information of the background image, the feature description information being used to represent image content features of the background image; generate the background image according to the feature description information; and cut the target object from the first initial image based on the correction mask image and overlay the target object to a corresponding position in the background image to generate a composite image.

[0116] According to one or more embodiments of the present disclosure, when the generation module 34 generates the background image according to the feature description information, it is specifically configured to: generate a feature complexity according to the feature description information, the feature complexity representing a complexity of image elements in the background image; determine a target processing end according to the feature complexity, the target processing end being a terminal or a cloud end; and call an image generation model of the target processing end to process the feature description information to obtain the background image.

[0117] The compression module 31, the transceiver module 32, the correction module 33 and the generation module 34 are connected in sequence. The image generation device 3 provided in the present embodiment can execute the technical solutions of the above-mentioned method embodiments, and has similar implementation principles and technical effects. Here, the present embodiment will not be described again.

[0118] Figure 12 A structural schematic diagram of an electronic device provided in an embodiment of the present disclosure is shown in FIG. 4. Figure 12 As shown in FIG. 4, the electronic device 4 comprises:

[0119] a processor 41 and a memory 42 connected with the processor 41 in communication;

[0120] The memory 42 stores computer execution instructions.

[0121] The processor 41 executes the computer execution instructions stored in the memory 42 to implement the image generation method in the embodiment shown in FIG. 4. Figures 2-10

[0122] Optionally, the processor 41 and the memory 42 are connected through a bus 43.

[0123] The related descriptions can be referred to in Figures 2-10 ​The corresponding description and effects of the steps in the corresponding embodiments are understood, and are not described in detail here.

[0124] The embodiment of the present disclosure provides a computer readable storage medium, the computer readable storage medium stores computer execution instructions, and the computer execution instructions are used for realizing the embodiment of the present disclosure when being executed by a processor. Figures 2-10 The image generation method provided by any one of the corresponding embodiments.

[0125] The embodiment of the present disclosure provides a computer program product, comprising a computer program, and the computer program realizes the embodiment of the present disclosure when being executed by a processor. Figures 2-10 The image generation method provided by any one of the corresponding embodiments.

[0126] In order to realize the above-mentioned embodiments, the embodiment of the present disclosure further provides an electronic device.

[0127] Reference Figure 13 , which shows a structural schematic diagram of an electronic device 900 suitable for realizing the embodiment of the present disclosure. The electronic device 900 can be a terminal device or a server. The terminal device can include but is not limited to a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a personal digital assistant (PDA), a tablet computer (PAD), a portable media player (PMP), a vehicle-mounted terminal (such as a vehicle-mounted navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. Figure 13 The electronic device shown is only an example, and should not bring any limitation to the function and use range of the embodiment of the present disclosure.

[0128] As shown in Figure 13 , the electronic device 900 can include a processing device (such as a central processor, a graphics processor, etc.) 901, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 902 or programs loaded from a storage device 908 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0129] In general, the following devices can be connected to the I / O interface 905: input devices 906, including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; output devices 907, including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 908, including, for example, a magnetic tape, a hard disk, and the like; and communication devices 909. The communication devices 909 can allow the electronic device 900 to communicate wirelessly or via a wire with other devices to exchange data. Although Figure 13 The electronic device 900 is shown with various devices, but it is understood that all of the illustrated devices are not required to implement or be present. More or fewer devices can alternatively be implemented or present.

[0130] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication devices 909, or installed from the storage devices 908, or installed from the ROM 902. When the computer program is executed by the processing devices 901, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.

[0131] It should be noted that the computer-readable medium in the above disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, an RF (radio frequency) or the like, or any suitable combination of the above.

[0132] The computer-readable medium described above can be contained in the electronic device described above; or can exist separately and not be assembled into the electronic device.

[0133] The computer-readable medium described above carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.

[0134] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0136] The units or modules involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit or module does not, in some cases, limit the unit itself.

[0137] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0138] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store the program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. It can include, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include one or more of an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0139] In a first aspect, according to one or more embodiments of the present disclosure, an image generation method is provided, comprising:

[0140] obtaining a first initial image, and performing compression processing on the first initial image to obtain a second initial image, wherein a data volume of the second initial image is smaller than a data volume of the first initial image; sending the second initial image to a cloud, and receiving an initial mask image returned by the cloud, wherein the initial mask image is used to indicate a second contour of a target object in the second initial image; in response to an adjustment instruction for the initial mask image, generating a corrected mask image, wherein the corrected mask image is used to indicate a first contour of the target object in the first initial image; and generating a composite image based on the corrected mask image, wherein the composite image contains the target object segmented based on the first contour.

[0141] According to one or more embodiments of the present disclosure, the method further comprises: obtaining first configuration information, wherein the first configuration information represents a starting state of an image preview function, and the image preview function is used to display a composite effect image based on the second initial image on a terminal before the composite image is generated; and determining a target compression model used to compress the first initial image according to the first configuration information.

[0142] According to one or more embodiments of the present disclosure, the determining the target compression model for compressing the first initial image according to the first configuration information comprises: obtaining a first information field in the first configuration information, the first information field being used to indicate a starting state of the image preview function; if a field value of the first information field is a first identifier representing that the image preview function is in an open state, determining a first type of compression model as the target compression model, wherein the first type of compression model is used at least to reduce image resolution of an image input to the first type of compression model; if the field value of the first information field is a second identifier representing that the image preview function is in a closed state, determining a second type of compression model as the target compression model, wherein the second type of compression model is used at least to reduce a number of color channels of an image input to the first type of compression model.

[0143] According to one or more embodiments of the present disclosure, the method further comprises: obtaining second configuration information, the second configuration information being used to represent available device resources of the terminal; and the determining the target compression model for compressing the first initial image according to the first configuration information comprises: determining the target compression model for compressing the first initial image according to the first configuration information and the second configuration information.

[0144] According to one or more embodiments of the present disclosure, the second configuration information comprises a second information field and / or a third information field, a field value of the second information field representing available computing resources of the terminal, and a field value of the third information field representing available network resources of the terminal; and the determining the target compression model for compressing the first initial image according to the first configuration information and the second configuration information comprises: determining a target type of compression model according to the first configuration information, the target type of compression model comprising at least two candidate compression models; and determining a target compression model matching the available computing resources and / or the available network resources from the target type of compression model according to the field values of the second information field and / or the third information field of the second configuration information.

[0145] According to one or more embodiments of the present disclosure, the generating the corrected mask image in response to the adjustment instruction for the initial mask image comprises: generating a first contour map based on the initial mask image, the first contour map comprising contour line segments constituting a first contour; generating a second contour map in response to an adjustment instruction for a contour line segment in the first contour map, by adjusting a line segment endpoint of the contour line segment from a first coordinate to a second coordinate; and generating the corrected mask image based on the second contour map.

[0146] According to one or more embodiments of the present disclosure, the adjustment instruction includes a first adjustment instruction and a second adjustment instruction, and the adjusting the line segment end point of the contour line segment in the first contour graph from the first coordinate to the second coordinate in response to the adjustment instruction for the contour line segment in the first contour graph to generate a second contour graph includes: segmenting at least one contour line segment into at least two sub-contour line segments in response to the first adjustment instruction for the contour line segment in the first contour graph; and adjusting the line segment end point of two adjacent sub-contour line segments from the first coordinate to the second coordinate in response to the second adjustment instruction for the sub-contour line segment to generate a second contour graph.

[0147] According to one or more embodiments of the present disclosure, the generating the composite image based on the modified mask image includes: obtaining feature description information of a background image, the feature description information being used to characterize image content features of the background image; generating a background image according to the feature description information; and cutting the target object from the first initial image based on the modified mask image and covering the target object to a corresponding position in the background image to generate the composite image.

[0148] According to one or more embodiments of the present disclosure, the generating the background image according to the feature description information includes: generating a feature complexity according to the feature description information, the feature complexity being a complexity of image elements in the background image; determining a target processing end according to the feature complexity, the target processing end being a terminal or a cloud; and invoking an image generation model of the target processing end to process the feature description information to obtain the background image.

[0149] In a second aspect, according to one or more embodiments of the present disclosure, an image generation apparatus is provided, and the image generation apparatus includes:

[0150] a compression module configured to obtain a first initial image and perform compression processing on the first initial image to obtain a second initial image, a data volume of the second initial image being smaller than a data volume of the first initial image;

[0151] a transceiver configured to send the second initial image to a cloud and receive an initial mask image returned by the cloud, the initial mask image being used to indicate a second contour of a target object in the second initial image;

[0152] a modification module configured to generate a modified mask image in response to an adjustment instruction for the initial mask image, wherein the modified mask image is used to indicate a first contour of a target object in the first initial image;

[0153] a generation module configured to generate a composite image based on the modified mask image, the composite image including a target object segmented based on the first contour.

[0154] According to one or more embodiments of the present disclosure, the compression module is further configured to: obtain first configuration information, the first configuration information representing a starting state of an image preview function, the image preview function being configured to display a composite effect image based on the second initial image on the terminal before the composite image is generated; and determine a target compression model for compressing the first initial image according to the first configuration information.

[0155] According to one or more embodiments of the present disclosure, when the compression module determines the target compression model for compressing the first initial image according to the first configuration information, the compression module is specifically configured to: obtain a first information field in the first configuration information, the first information field being configured to indicate the starting state of the image preview function; if a field value of the first information field is a first identifier representing that the image preview function is in an open state, determine a first type of compression model as the target compression model, wherein the first type of compression model is at least configured to reduce an image resolution of an image input into the first type of compression model; and if the field value of the first information field is a second identifier representing that the image preview function is in a closed state, determine a second type of compression model as the target compression model, wherein the second type of compression model is at least configured to reduce a number of color channels of an image input into the first type of compression model.

[0156] According to one or more embodiments of the present disclosure, the compression module is further configured to: obtain second configuration information, the second configuration information representing available device resources of the terminal; and when the compression module determines the target compression model for compressing the first initial image according to the first configuration information, the compression module is specifically configured to: determine the target compression model for compressing the first initial image according to the first configuration information and the second configuration information.

[0157] According to one or more embodiments of the present disclosure, the second configuration information includes a second information field and / or a third information field, a field value of the second information field representing available computing resources of the terminal, and a field value of the third information field representing available network resources of the terminal; and when the compression module determines the target compression model for compressing the first initial image according to the first configuration information and the second configuration information, the compression module is specifically configured to: determine a target type of compression model according to the first configuration information, the target type of compression model including at least two candidate compression models; and determine a target compression model that matches the available computing resources and / or the available network resources from the target type of compression model according to the field values of the second information field and / or the third information field of the second configuration information.

[0158] According to one or more embodiments of the present disclosure, the correction module is specifically configured to: generate a first contour map based on the initial mask image, the first contour map including contour line segments constituting a first contour; in response to an adjustment instruction for a contour line segment in the first contour map, adjust an end point of the contour line segment from a first coordinate to a second coordinate to generate a second contour map; and generate the corrected mask image based on the second contour map.

[0159] According to one or more embodiments of the present disclosure, the adjustment instruction includes a first adjustment instruction and a second adjustment instruction, and the correction module, in response to the adjustment instruction for the contour line segment in the first contour map, adjusts the end point of the contour line segment from the first coordinate to the second coordinate to generate the second contour map, is specifically configured to: in response to the first adjustment instruction for the contour line segment in the first contour map, split at least one contour line segment into at least two sub-contour line segments; and in response to the second adjustment instruction for the sub-contour line segments, adjust the end point of the adjacent two sub-contour line segments from the first coordinate to the second coordinate to generate the second contour map.

[0160] According to one or more embodiments of the present disclosure, the generation module is specifically configured to: obtain feature description information of a background image, the feature description information being used to represent image content features of the background image; generate a background image according to the feature description information; and based on the corrected mask image, cut the target object from the first initial image and overlay the target object to a corresponding position in the background image to generate the composite image.

[0161] According to one or more embodiments of the present disclosure, the generation module, in generating the background image according to the feature description information, is specifically configured to: generate a feature complexity according to the feature description information, the feature complexity representing a complexity of image elements in the background image; determine a target processing end according to the feature complexity, the target processing end being a terminal or a cloud end; and invoke an image generation model of the target processing end to process the feature description information to obtain the background image.

[0162] In a third aspect, according to one or more embodiments of the present disclosure, an electronic device is provided, including: at least one processor and a memory;

[0163] The memory stores computer-executable instructions;

[0164] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image generation method as described in the above first aspect and various possible designs of the first aspect.

[0165] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer readable storage medium is provided, and the computer readable storage medium has stored therein computer executing instructions which, when executed by a processor, implement the image generation method according to the first aspect and various possible designs of the first aspect.

[0166] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, and the computer program product includes a computer program which, when executed by a processor, implements the image generation method according to the first aspect and various possible designs of the first aspect.

[0167] The above description merely illustrates the preferred embodiments of the present disclosure and the principles of the applied technologies. It should be understood by those skilled in the art that the disclosed scope of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by the combinations of the above technical features or equivalent features, without departing from the above disclosed concepts. For example, the above technical features can be replaced with the technical features disclosed in the present disclosure (but not limited to) having similar functions to form technical solutions.

[0168] In addition, although each operation is described in a particular order, this should not be understood as requiring the operations to be performed in the particular order shown or in a sequential order. In certain circumstances, multitasking and parallel processing can be advantageous. Similarly, although several implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments can also be combined in a single embodiment. Conversely, various features described in the context of a single embodiment can also be separated and implemented in multiple embodiments.

[0169] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. An image generation method characterized by, The method comprises: obtaining a first initial image, and performing compression processing on the first initial image to obtain a second initial image, the data volume of the second initial image being smaller than the data volume of the first initial image; sending the second initial image to a cloud, and receiving an initial mask image returned by the cloud, the initial mask image being used to indicate a second contour of a target object in the second initial image; in response to an adjustment instruction for the initial mask image, generating a corrected mask image, wherein the corrected mask image is used to indicate a first contour of a target object in the first initial image; based on the corrected mask image, generating a composite image, the target object in the composite image being segmented based on the first contour.

2. The method of claim 1, wherein, The method further comprises: obtaining first configuration information, the first configuration information representing a starting state of an image preview function, the image preview function being used to display a composite effect image based on the second initial image on a terminal before the composite image is generated; determining a target compression model used to compress the first initial image according to the first configuration information.

3. The method of claim 2, wherein, The determination of the target compression model used to compress the first initial image according to the first configuration information comprises: obtaining a first information field in the first configuration information, the first information field being used to indicate the starting state of the image preview function; if a field value of the first information field is a first identifier representing that the image preview function is in an open state, determining a first type of compression model as the target compression model, wherein the first type of compression model is used to at least reduce the image resolution of an image input into the first type of compression model; if the field value of the first information field is a second identifier representing that the image preview function is in a closed state, determining a second type of compression model as the target compression model, wherein the second type of compression model is used to at least reduce the number of color channels of an image input into the first type of compression model.

4. The method of claim 2, wherein, The method further comprises: obtaining second configuration information, the second configuration information being used to represent available device resources of a terminal; The determination of the target compression model used to compress the first initial image according to the first configuration information comprises: determining the target compression model used to compress the first initial image according to the first configuration information and the second configuration information.

5. The method according to claim 4, characterized in that The second configuration information comprises a second information field and / or a third information field, a field value of the second information field representing available computing resources of the terminal, and a field value of the third information field representing available network resources of the terminal; The determination of the target compression model used to compress the first initial image according to the first configuration information and the second configuration information comprises: determining a target type of compression model according to the first configuration information, the target type of compression model comprising at least two candidate compression models; According to the field value of the second information field and / or the third information field of the second configuration information, a target compression model matching the available computing resource and / or the available network resource is determined from the target category of compression models.

6. The method of claim 1, wherein, The response to the adjustment instruction for the initial mask image includes: Based on the initial mask image, a first contour map is generated, and the first contour map includes a contour line segment constituting the first contour. In response to the adjustment instruction for the contour line segment in the first contour map, the line segment end point of the contour line segment is adjusted from the first coordinate to the second coordinate to generate a second contour map. Based on the second contour map, the corrected mask image is generated.

7. The method of claim 6, wherein, The adjustment instruction includes a first adjustment instruction and a second adjustment instruction, and the response to the adjustment instruction for the contour line segment in the first contour map includes: In response to the first adjustment instruction for the contour line segment in the first contour map, at least one contour line segment is divided into at least two sub-contour line segments. In response to the second adjustment instruction for the sub-contour line segment, the line segment end points of the adjacent two sub-contour line segments are adjusted from the first coordinate to the second coordinate to generate a second contour map.

8. The method of claim 1, wherein, The generation of the composite image based on the corrected mask image includes: Obtain feature description information of a background image, the feature description information being used to represent image content features of the background image; According to the feature description information, a background image is generated; Based on the corrected mask image, the target object is cut from the first initial image and overlaid to the corresponding position in the background image to generate the composite image.

9. The method of claim 8, wherein, According to the feature description information, a background image is generated, including: According to the feature description information, a feature complexity is generated, which represents the complexity of image elements in the background image; According to the feature complexity, a target processing end is determined, which is a terminal or a cloud end; An image generation model of the target processing end is called to process the feature description information to obtain the background image.

10. An image generation apparatus characterized by comprising: It includes: A compression module is configured to obtain a first initial image and compress the first initial image to obtain a second initial image, wherein the data volume of the second initial image is smaller than that of the first initial image; A transceiver module is configured to send the second initial image to a cloud end and receive an initial mask image returned by the cloud end, wherein the initial mask image is used to indicate a second contour of a target object in the second initial image; A correction module is configured to generate a corrected mask image in response to an adjustment instruction for the initial mask image, wherein the corrected mask image is used to indicate a first contour of a target object in the first initial image; A generation module is configured to generate a composite image based on the corrected mask image, wherein the composite image contains a target object segmented based on the first contour.

11. An electronic device, comprising: It includes: A processor and a memory; The memory stores computer execution instructions; The processor executes the computer-executed instructions stored in the memory, so that the processor executes the image generation method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores the computer-executed instructions, and when the processor executes the computer-executed instructions, the image generation method according to any one of claims 1 to 9 is implemented.

13. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the image generation method according to any one of claims 1 to 9.