Image generation method and device, storage medium and computer device

By performing emotion recognition and proportion analysis on video background images and combining them with a text library to generate video covers, the problem of low efficiency in manually designing video covers is solved, and efficient and low-cost cover generation is achieved.

CN115409917BActive Publication Date: 2026-11-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210981028.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-16
Publication Date
2026-11-06
Estimated Expiration
2042-08-16

AI Technical Summary

Technical Problem

In existing technologies, video cover design relies on manual design, resulting in long design cycles and high costs, especially when there are many videos, which leads to low efficiency.

Method used

By selecting background images based on target videos, performing emotion recognition, determining the emotional features of facial information, and obtaining the area ratio of the portrait region, the text area is determined based on the ratio and preset comparison results. The target text image that matches the emotional features is generated using a text library, and the video cover is automatically generated.

Benefits of technology

It shortened the video cover design cycle, improved design efficiency, reduced costs, and ensured the standardization and quality of the cover design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115409917B_ABST
    Figure CN115409917B_ABST
Patent Text Reader

Abstract

The application discloses an image generation method, which comprises the following steps: selecting a background image based on a target video, wherein the background image carries human face information; performing emotion recognition on the background image to determine the emotional characteristics corresponding to the human face information; obtaining the first area ratio of the portrait area where the character information is located in the background image; determining the position of the script area according to the comparison result of the first area ratio and a preset area ratio; generating a target script image matched with the emotional characteristics in the script area based on a script library to obtain a cover image generated by the target script image and the background image. The application applies artificial intelligence technology to perform emotion recognition on the background image selected from the target video, obtains the emotional characteristics corresponding to the human face in the background image, and matches the appropriate target script image from the script library based on the emotional characteristics, so that the cover image of the target video is automatically generated according to the target script image, and the efficiency of cover generation is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer vision technology, and more specifically, to an image generation method, apparatus, storage medium, and computer device. Background Technology

[0002] The ever-expanding user base of mobile internet has fueled the rapid development of the video creation industry. Compared to text, video carries a higher information capacity. Video covers, as previews of the video content, can inform users of potential clicks and showcase the core message, giving them a general idea of ​​the video's content. High-quality video covers effectively highlight the video's theme and showcase its key features.

[0003] Currently, video cover design is primarily done manually by designers. Designers need to review video content and select suitable footage before creating a cover. However, when there is a large amount of video content or a large number of videos to design, the cover design cycle becomes lengthy, and manual design is costly. Therefore, the manual method of video cover design suffers from high costs and low efficiency. Summary of the Invention

[0004] This application provides an image generation method, apparatus, storage medium, and computer device, aiming to improve the efficiency of video cover design.

[0005] On one hand, embodiments of this application provide an image generation method, which includes: selecting a background image based on a target video, the background image carrying facial information; performing emotion recognition on the background image to determine the emotional features corresponding to the facial information; obtaining a first area ratio of the portrait area where the person information is located in the background image; determining the position of a text area based on the comparison result of the first area ratio and a preset ratio, the layer where the text area is located covering the layer where the background image is located; within the text area, generating a target text image that matches the emotional features based on a text library, and obtaining a cover image generated by the target text image and the background image.

[0006] On the other hand, this application embodiment also provides an image generation device, which includes: an image selection module for selecting a background image based on a target video, the background image carrying facial information; an emotion recognition module for performing emotion recognition on the background image to determine the emotional features corresponding to the facial information; a proportion acquisition module for acquiring a first area proportion of the portrait area where the person information is located in the background image; a region determination module for determining the position of the text area based on the comparison result of the first area proportion and a preset proportion, the layer where the text area is located covering the layer where the background image is located; and a cover generation module for generating a target text image matching the emotional features based on a text library within the text area, thereby obtaining a cover image generated by the target text image and the background image.

[0007] On the other hand, this application also provides a computer device, which includes a processor and a memory. The memory stores computer program instructions, and when the computer program instructions are called by the processor, the above-described image generation method is executed.

[0008] On the other hand, embodiments of this application also provide a computer-readable storage medium storing program code, wherein the above-described image generation method is executed when the program code is run by a processor.

[0009] On the other hand, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a storage medium. A processor of a computer device reads the computer instructions from the storage medium and executes the computer instructions, causing the computer to perform the steps in the image generation method described above.

[0010] This application provides an image generation method that selects a background image based on a target video, performs emotion recognition on the background image to determine the emotional features corresponding to facial information, and obtains the first area ratio of the image region containing the person's information in the background image. Further, based on the comparison result of the first area ratio and a preset ratio, the position of the text region is determined, and within the text region, a target text image matching the emotional features is generated based on a text library, resulting in a cover image generated from the target text image and the background image. In this way, a background image containing facial information can be selected from the target video, and the emotional features of the face can be obtained through emotion recognition. Furthermore, a target text image matching the emotional features is displayed on the text region of the background image, and a cover image corresponding to the target video is automatically generated based on the background image and the target text image, thereby shortening the design cycle and greatly improving the design efficiency of the cover image. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 A schematic diagram of the system architecture of an image generation method provided in an embodiment of this application is shown.

[0013] Figure 2 A flowchart illustrating an image generation method provided in an embodiment of this application is shown.

[0014] Figure 3 A schematic diagram of a layer design provided in an embodiment of this application is shown.

[0015] Figure 4 This illustration shows a schematic diagram of a method for determining a text area according to an embodiment of this application.

[0016] Figure 5 This illustration shows another schematic diagram of determining the text area provided in an embodiment of this application.

[0017] Figure 6 This illustration shows another method for determining a text area according to an embodiment of this application.

[0018] Figure 7 A flowchart illustrating another image generation method provided in an embodiment of this application is shown.

[0019] Figure 8 The illustration shows an application scenario diagram of video cover generation provided by an embodiment of this application.

[0020] Figure 9 This illustration shows a scenario diagram of determining a text area according to an embodiment of this application.

[0021] Figure 10 This illustration shows a schematic diagram of a display target text image provided in an embodiment of this application.

[0022] Figure 11 This illustration shows a scenario diagram of generating a cover image according to an embodiment of this application.

[0023] Figure 12 A flowchart of a video cover generation task provided in an embodiment of this application is shown.

[0024] Figure 13 A block diagram of an image generation apparatus provided in an embodiment of this application is shown.

[0025] Figure 14 This is a module block diagram of a computer device provided in an embodiment of this application.

[0026] Figure 15 This is a block diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0027] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0028] In some processes described in the specification, claims, and the foregoing drawings, multiple steps are included in a specific order. However, it should be clearly understood that these steps may be performed in any order or in parallel. The step numbers are merely used to distinguish different steps and do not represent any execution order. Furthermore, descriptions such as "first" and "second" in this document are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0029] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0030] Internet products often contain video content, and the video cover is a crucial part of that content, directly impacting the user's first impression and influencing click-through rates. To showcase the video's core message and help users quickly grasp its main content, product operations and design personnel create video covers tailored to the video's content. These covers clearly define the video's theme and highlight its key features.

[0031] In the cover design process, designers typically need to watch the entire video content and then select video images that meet specific requirements (such as clarity, image size, etc.) as background images for the video cover. Based on their understanding of the video content, they then design different text elements on the background image. However, when the video is very long or there are many video covers waiting to be designed, the design cycle and cost increase, and design efficiency is affected because each cover needs to be designed manually based on the video content.

[0032] To address the aforementioned problems, the inventors, through research, proposed the image generation method provided in this application. This method selects a background image based on a target video, performs emotion recognition on the background image to determine the emotional features corresponding to facial information, and obtains the first area ratio of the image region containing the person's information in the background image. Further, based on the comparison between the first area ratio and a preset ratio, the position of the text region is determined, and within the text region, a target text image matching the emotional features is generated based on a text library, resulting in a cover image generated from the target text image and the background image. Therefore, given a video, a text image that resonates with the emotions of the person in the background image can be generated. This allows for the rapid generation of a video cover based on the background image and the text image, thereby shortening the cover design cycle and improving design efficiency while reducing design costs.

[0033] The system architecture of the image generation method involved in this application will be introduced below.

[0034] like Figure 1 As shown, the image generation method provided in this application embodiment can be applied in system 300. Database 310 can be used to store image data. For the image generation method in this application embodiment, the image data may include preset text images in a text library. The preset text images are text images pre-designed by professional designers. Each preset text image is associated with a corresponding sentiment tag. The sentiment tag can be manually marked or automatically marked based on deep learning or machine learning algorithms.

[0035] Optionally, Figure 1 The system 300 shown can be a client-server (C / S) system architecture. The server can be a cloud server 330, and the clients can include laptops 320, tablets 340, desktop computers 360, and smartphones 380. The cloud server 330 is equipped with a data processing module 331, which serves as the system backend for generating the cover image, and the desktop computer 360 is equipped with a data interaction module 361, which serves as the system frontend for data transmission and display.

[0036] For example, a user can upload a video for which a cover image needs to be generated, i.e., the target video, through the data interaction module 361 on the desktop computer 360. After the cloud server 330 receives the target video through the network, it generates a cover image using the data processing module 331 and returns the cover image to the data interaction module 361, which can then display the video's cover image.

[0037] It is worth noting that, Figure 1 This is merely a schematic diagram of the system architecture provided in this application embodiment. The system architecture and application scenarios described in this application embodiment are for the purpose of more clearly illustrating the technical solutions of this application embodiment and do not constitute a limitation on the technical solutions provided in this application embodiment. For example, Figure 1 The cloud server 330 is used to generate the cover image. In other cases, the client device 350 can retrieve a preset text image from the cloud server 330 and generate the cover image. In this case, the cloud server 330 only serves as a storage device for the text image. As those skilled in the art will understand, with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in this application are also applicable to similar technical problems.

[0038] Please see Figure 2 , Figure 2 A schematic flowchart of an image generation method according to an embodiment of this application is shown. In a specific embodiment, the image generation method is applied to, for example... Figure 13 The image generating apparatus 1100 and the computer device 1200 equipped with the image generating apparatus 1100 are shown. Figure 14 ).

[0039] The following will use a computer device as an example to illustrate the specific process of this embodiment. It is understood that the computer device used in this embodiment can be a server or a terminal, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, blockchain, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The image generation method specifically includes the following steps: Step S110: Select a background image based on the target video.

[0040] Video data is an indispensable business resource for current internet products. Before playback, videos require specific cover images to showcase their core content and guide user clicks and conversions. However, the efficiency and output of manually designing cover images based on video content each time are easily limited by operations and design personnel. This application's embodiment uses machines to automatically generate video cover images based on video content, which can improve the efficiency of cover image design and reduce design costs.

[0041] The target video refers to the video for which a cover image needs to be generated. The video format can include media formats such as AVI (AudioVideo Interactive), WMV (Windows Media Video), and MP4 (Moving Picture Experts Group-4), and is not limited here.

[0042] For example, target videos can be obtained from the client or in batches from a video database. For instance, user-uploaded video logs (Vlogs) can be retrieved from a video creation platform as target videos to generate cover images for those Vlogs. Alternatively, each episode of a TV series can be retrieved from a video playback platform's video database as target videos to generate cover images for each episode.

[0043] To help users quickly grasp the general content of a video, in the field of visual design, people are often used as the main element for the background image of a video cover. This is because people in videos often have social influence or celebrity appeal, and text elements designed in conjunction with the emotional characteristics of the person's facial expressions are more likely to highlight the video's theme and highlights. In the embodiments of this application, the background image is the background of the video cover, and this background image carries facial information. The facial information can be facial features or facial images, so as to obtain the emotional characteristics of the person's face based on the facial information.

[0044] In some embodiments, the step of selecting a background image based on a target video may include: (1) Obtain a first preset number of first images based on the target video.

[0045] Here, the first image refers to a frame image selected from the target video, and the first preset number refers to the number of first images selected from the target video. The size of the first preset number can be determined at least by the device performance of the computer equipment generating the cover image or the required clarity of the background image. For example, when the memory utilization rate of the computer equipment is less than 50%, for a video with a duration of 3 minutes, by extracting one first image every second, a first preset number of 180 first images can be extracted.

[0046] As one implementation method, the performance status of the computing device at the current moment can be assessed, and a first preset number can be determined based on the performance status, thereby acquiring the first preset number of first images. For example, a PC computer can determine its performance status by obtaining the utilization rate of its own Graphics Processing Unit (GPU), and then acquire the first preset number of first images based on the performance status.

[0047] (2) According to the image clarity filtering rules, obtain a second preset number of second images from the first preset number of first images.

[0048] Image sharpness is one of the standards for measuring image quality; a sharp image provides a comfortable and accurate visual experience. Therefore, it is necessary to select an image that meets a specific level of sharpness (i.e., the second image) to determine the background image. The image sharpness filtering rule refers to the rule for selecting images that meet a preset sharpness from a first preset number of first images. The second preset number is less than the first preset number.

[0049] In one implementation, after selecting the first image from the target video, a sharpness detection algorithm can be used to detect the sharpness of each first image, calculate the sharpness of each first image, sort the first images in descending order according to the numerical value of the sharpness, and then select the second preset number of first images with the highest sharpness ranking from the sorted images as the second images.

[0050] As another implementation, a deep neural network (DNN) model can be used to obtain the sharpness of each first image, and the sharpness of each first image can be compared with a preset sharpness to filter out a second preset number of second images that meet the preset sharpness. In this case, the DNN can directly call the application programming interface (API) for sharpness detection provided by a third party.

[0051] (3) Determine the background image from the second preset number of second images according to the image filtering rules.

[0052] Considering that background images not only need to meet certain clarity requirements but also need to contain facial information to capture the emotional characteristics of the face, this application embodiment selects background images containing facial information by setting image filtering rules. Optionally, the image filtering rules may include the number of people in the second image, the optimal ratio of the frontal figures to the total image area (i.e., area ratio filtering rules), and the numerical range of the three color elements (hue, saturation, and brightness). For example, the optimal ratio of the frontal figures to the total image area in the area ratio filtering rules can be 30%, meaning that the second image with the ratio of the frontal figures to the total image area closest to 30% can be used as the background image.

[0053] Optionally, the numerical range of the three color elements of an image can be determined by the video type. For example, for horror videos, the hue, saturation, and brightness values ​​of the background image should fall within the range that makes the image have a cool color tone. Then, a second image whose values ​​fall within this range is selected as the background image. Optionally, the number of people in the second image (up to three) can be set as an image filtering rule to determine the background image. The specific image filtering rule can be quantified according to the actual needs of the application scenario and is not limited here.

[0054] As one implementation, the step of determining a background image from a second preset number of second images according to image filtering rules may include: (3.1) Perform target detection on each second image separately.

[0055] (3.2) When at least one second image is detected to carry facial information, at least one second image is filtered according to the image filtering rules to obtain the background image.

[0056] (3.3) When it is detected that each second image does not carry facial information, return to the step of obtaining a first preset number of first images based on the target video.

[0057] For example, an object detection algorithm (such as the YOLO algorithm) can be used to perform object detection on each second image to determine whether the detected second image carries facial information. When at least one second image is detected to carry facial information, image filtering can be performed on each second image carrying facial information according to image filtering rules to obtain a background image.

[0058] Specifically, a second area ratio of the face region in the second image can be obtained. This second area ratio refers to the ratio of the face region to the area of ​​the second image containing the face region. Further, the second image carrying face information is filtered according to the second area ratio and an area ratio filtering rule to obtain a background image. For example, the second image with the second area ratio closest to the optimal ratio is used as the background image. Optionally, when it is detected that no face information is carried in each second image, the step of obtaining a first preset number of first images based on the target video can be repeated to select new first images from the target video.

[0059] In this embodiment of the application, the computer device first filters out a number of second images that meet the image clarity filtering rules, and then determines the background image that meets the image filtering rules from the number of second images. In this process of determining the background image, the image clarity filtering rules and the image filtering rules are executed accurately according to the quantitative rules, taking into account that the selection of background images by humans is affected by the professional ability of the designer.

[0060] For example, designers with different professional backgrounds and skill levels may select different background images from the same video. Therefore, using quantified rules to select background images can ensure the quality of the selection and make the selection process more standardized.

[0061] Step S120: Perform emotion recognition on the background image to determine the emotional features corresponding to the facial information.

[0062] As one implementation method, an emotion recognition training task can be constructed based on training set data (facial sample images) to obtain an emotion recognition model. In this embodiment, the emotion recognition model can identify seven emotion features of a face, including Angry, Disgusted, Fearful, Happy, Neutral, Sad, and Surprised.

[0063] It should be noted that the type and number of emotional features can be designed according to the actual cover design requirements, and are not limited here. Furthermore, the background image is input into a trained emotion recognition model, which can output the emotional features corresponding to the facial information in the background image.

[0064] As another implementation, emotion recognition can be performed on the background image by a third party that provides emotion recognition services. Specifically, by calling the emotion recognition API provided by the third-party service provider, the background image can be sent to the third-party service provider through the API, and the emotional features corresponding to the facial information on the background image can be obtained through the API.

[0065] Step S130: Obtain the first area ratio of the portrait area containing the person's information in the background image.

[0066] Here, "person information" refers to information about the human body in the background image obtained through target detection, including images of the entire body or parts of the person's body. The first area ratio refers to the ratio of the area containing the person information (the portrait area) to the area of ​​the background image. The preset ratio is a predetermined threshold used to determine the text area; this preset ratio is set by professionals, and in this embodiment, it is set to 0.53.

[0067] As one implementation method, object detection algorithms can be used to detect the area containing human information in a background image and its proportion of the background image's area. For example, Faster-RCNN (Regions with Convolutional Neural Network Features) or YOLO (You Only Look Once) algorithms can be used to detect the human image area in the background image and calculate the proportion of that human image area to the background image's area.

[0068] Step S140: Determine the location of the text area based on the comparison results of the first area ratio and the preset ratio.

[0069] Typically, cover images, besides the background figures, also include text closely related to the video's theme. The text mainly includes information about the video content and can be composed of artistic fonts in different design styles. In the cover design process, the visual presentation of the cover is achieved by layering different elements in a specific order. Multiple design elements can be drawn on each layer; however, this embodiment assumes only one design element per layer. Please refer to... Figure 3 , Figure 3 A schematic diagram of a layer design is shown.

[0070] In this design, the text area 431, located on layer 430, overlaps the background image layer 410. This means the text area 431 is on a higher layer than the background image layer 410. From the user's perspective, the text area 431 is closer to the user than the background image layer 410. It's important to note that the layers are transparent; the shadow area of ​​layer 430 is transparent. The text image is displayed in text area 431 of layer 430. To prevent the text from interfering with the display of information in the background image, the text area has a specific size and relative position. These dimensions and position are determined based on facial information detected from the background image, preventing the text from obscuring the face.

[0071] In some embodiments, the step of determining the location of the text area based on the comparison result of the first area proportion and the preset proportion may include: (1) When the proportion of the first area is greater than the preset proportion, determine the face area of ​​each face information and determine the text area based on each face area.

[0072] (2) When the proportion of the first area is not greater than the preset proportion, the text area is determined according to the area where the character information is located.

[0073] Here, "person information" refers to information about the human body in the background image obtained through target detection, including images of the entire body or parts of the body. "First area ratio" refers to the ratio of the area containing the person information to the area of ​​the background image. "Preset ratio" is a predetermined threshold used to determine the text area; this preset ratio is set by professionals, and in this embodiment, it is set to 0.53.

[0074] As one implementation method, an object detection algorithm can detect the percentage of the background image area containing the person's information. If this percentage is not greater than a preset percentage, the area outside the person's information area can be defined as the text area. Optionally, the number of text areas can be determined based on the specific location of the person's information in the background image.

[0075] like Figure 4 As shown, the target detection algorithm determines the area 510a where the person information is located in the background image 520a. Further, it is calculated that the first area ratio of the area 510a where the person information is located is not greater than the preset ratio (0.53), and it is determined that the position of the area 510a where the person information is located is on one side of the background image 520a. Then, the area outside the area 510a where the person information is located in the background image 520a is determined as the text area (shadow area).

[0076] Optionally, such as Figure 5 As shown, the first area ratio of the area 510b where the person information is located is calculated to be no greater than the preset ratio (0.53), and the position of the area 510b where the person information is located is determined to be in the middle of the background image 520b. Then, the area outside the area 510b where the person information is located in the background image 520b can be determined as the text area (shaded area). At this time, two text areas can be determined.

[0077] As another implementation method, after detecting the proportion of the area where the person information is located in the background image to the first area of ​​the background image by the target detection algorithm, when the first area proportion is calculated to be greater than the preset proportion, the face area of ​​each face information can be determined, and then the area in the background image that does not contain all face areas can be determined as the text area.

[0078] like Figure 6As shown, the target detection algorithm determines the first area ratio of the background image 630 where the person information is located in the background image 640. When the first area ratio is greater than the preset ratio, the face regions 610 and 620 of the two face information are determined respectively. Furthermore, based on the position of the face regions 610 and 620, the face regions are avoided, and the regions in the background image that do not contain all face regions are determined as text regions (shadow regions).

[0079] In other embodiments, when the first area proportion is not greater than a preset proportion, multiple image regions other than the portrait region in the background image can be determined, and the color variance of each image region can be obtained. This color variance is used to characterize the state of color change in the image region, and then the image region whose color variance is within the preset range is taken as the text region. For example, the color values ​​of pixels in the image region (e.g., optical primary colors) can be obtained by pixel scanning.

[0080] Therefore, outside the area containing the person's image, find a continuous, uniformly colored image region. If the color variation in this region is very uniform, then this image region is suitable for displaying text images. By quantifying the color steps of the image, compare whether the variance of the color values ​​in the image region is within a preset variance range. If it is within a range, it means that the color variation is not significant and the color variation is relatively uniform, making it suitable as a text region.

[0081] Step S150: Within the text area, generate a target text image that matches the emotional features based on the text library, and obtain a cover image generated from the target text image and the background image.

[0082] Besides showcasing the video content, cover images also need to attract attention. Designing the text itself as a recognizable image, i.e., a text-image, can enhance the overall visual impact of the cover image, making the information it conveys more appealing. In the field of visual communication design, designers often create text formats that match the emotions of the people in the image. Therefore, this application embodiment generates target text images based on the emotional characteristics of the people in the text area.

[0083] The target text image can be an image composed of design elements such as text and graphics. Because the size and layout of the target text image need to match the size and position of the text area, in addition to the target text image expressing emotions that match the emotions of the people in the background image, it also needs to satisfy the spatial information of the text area. Then, based on the spatial information and emotional characteristics, the target text image is determined from the text library.

[0084] The text library stores preset text images, which are pre-designed by professionals. Each preset text image has corresponding size information (such as the length and width of the image) and an emotion tag. The emotion tag corresponds to the emotional features of a human face. For example, the emotion tag "angry" corresponds to the emotion feature "angry".

[0085] Optionally, the emotional tags for the preset text images can be manually assigned or automatically assigned using a deep neural network model. The preset text images in the text library can be adjusted according to actual business changes, such as adding preset text images based on the type of newly added videos, thereby making the construction of the text library scalable and improving the richness of the generated cover images.

[0086] After selecting multiple preset text images from the text library that match the emotional tags of the characters in the background images, an intermediate text image can be determined from these preset images based on spatial information. To ensure that the colors of the target text image match the colors of the background image, that is, to make the target text image conform to the color atmosphere of the background image, the intermediate text image can be processed to obtain the target text image.

[0087] In some embodiments, the step of generating a target text image that matches emotional features based on a text library within the text area, and obtaining a cover image generated from the target text image and the background image, may include: (1) Match the emotional features with the emotional tags of each preset copy image in the copy library to obtain the emotional image.

[0088] (2) Based on the spatial information of the text area, the emotional image is filtered to obtain the intermediate text image.

[0089] (3) Perform image processing on the middle text image based on the color information of the background image to obtain the target text image.

[0090] Among them, the emotional image refers to a preset text image that matches the emotional tag and emotional features. Color information can include hue value, saturation, and brightness. Considering that the colors of the preset text image may not match the background image, image processing can be used to optimize the color of the image.

[0091] Spatial information refers to the size of the text area and its relative position on the background image. Based on this spatial information, the layout style of the text image can be determined; for example, the text on the text image can be laid out horizontally or vertically. The size of the text image can also be determined. For example, after determining the text area, its width and length can be obtained, and the aspect ratio of the text area can be calculated. The center point of the text area can also be obtained, and its relative position on the background image can be determined based on the coordinates of the center point.

[0092] As one implementation method, preset text images that match the emotional tags and emotional features in the text library are used as emotional images. The first size information of each emotional image is matched with the spatial information. When the first size information is the same as the second size information indicated by the spatial information, the emotional image is determined as an intermediate text image. When the first size information is different from the second size information indicated by the spatial information, the first size information of the emotional image is adjusted to the second size information, and the size-adjusted emotional image is determined as an intermediate text image.

[0093] Furthermore, the average hue, saturation, and brightness of the background image can be obtained, i.e., the color information of the background image can be acquired. This color information can reflect the color atmosphere of the background image, such as warm or cool tones. Therefore, the hue, saturation, and brightness of the intermediate text image can be adjusted based on the average hue, saturation, and brightness of the background image. The adjusted intermediate text image is then used as the target text image, making the adjusted target text image more suitable for the atmosphere of the current scene and improving the quality of the cover. For example, for horror videos, the background image typically selected has a cool color atmosphere. Based on the acquired color information of this background image, the intermediate text image can be processed to obtain a target text image with a cool color tone.

[0094] (4) Display the target text image within the text area to obtain the target text area containing the target text image.

[0095] (5) Generate the cover image of the target video based on the layer where the background image is located and the layer where the target text image is located.

[0096] As one implementation method, after obtaining the target text image, the target text image can be displayed within the text area to obtain the target text area containing the target text image. Further, the layer containing the background image and the layer containing the target text image are overlaid to synthesize the cover image of the target video.

[0097] In this embodiment, a background image can be selected based on the target video, and emotion recognition can be performed on the background image to determine the emotional features corresponding to the facial information. The first area ratio of the image region containing the person's information in the background image is obtained. Further, based on the comparison result between the first area ratio and a preset ratio, the position of the text region is determined. Within the text region, a target text image matching the emotional features is generated based on a text library, resulting in a cover image generated from the target text image and the background image. Thus, a background image containing facial information is selected from the target video according to image clarity filtering rules and image filtering rules, making the selection of the background image standardized.

[0098] Furthermore, based on the emotional features of faces, emotional images that match the emotional features of faces are selected from an expandable copywriting library. Target copywriting images are then determined based on these emotional images, and the copywriting image is displayed on the copywriting area of ​​the background image. Finally, a cover image corresponding to the target video is automatically generated based on the background image and the copywriting image, thereby shortening the design cycle and greatly improving the design efficiency of the cover image. At the same time, the standardized selection of background images and the expandability of the copywriting library facilitate the optimization of the generated cover image, thereby reducing optimization costs.

[0099] Based on the methods described in the above embodiments, the following examples will provide further detailed explanations.

[0100] The image generation method in this application relates to Artificial Intelligence (AI) technology. AI technology utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce new intelligent machines capable of reacting in a manner similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.

[0101] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0102] Computer vision (CV), a branch of artificial intelligence, is a science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes in recognizing, detecting, and measuring targets, and then performs image processing to create images more suitable for human observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data.

[0103] Computer vision technology typically includes object detection, emotion recognition, image processing, image recognition, image semantic understanding, image retrieval, OCR, image generation, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.

[0104] The image generation method provided in this embodiment specifically involves technologies such as artificial intelligence and computer vision. The following description will take the integration of an image generation device into a computer device as an example, and will focus on… Figure 7 The process shown combines Figure 8 The application scenarios shown are described in detail. This computer device can be a server or a terminal device, etc. Please refer to [link / reference]. Figure 7 , Figure 7 This application illustrates another image generation method provided by an embodiment of the present application. In a specific embodiment, this image generation method can be applied to, for example... Figure 8 The video cover generation scenario shown.

[0105] Online video media platforms can provide users with access to a vast library of videos online. This online video media platform 700 includes a backend cloud training server 710 and a cloud execution server 730. The cloud training server 710 is used to train a tagging model that labels preset text images, while the cloud execution server 730 is used to deploy the tagging model and generate corresponding cover images for target videos.

[0106] It should be noted that the cloud execution server 730 can also be applied to business scenarios such as video playback; this application embodiment only focuses on the scenario of video cover generation. Specifically, the front end is the platform operation client 720 opened on computer 740 when platform operators use the video cover generation scenario. The image generation method may specifically include the following steps: Step S210: The computer device selects a background image based on the target video.

[0107] In some embodiments, the step of the computer device selecting a background image based on a target video may include: (1) The computer device acquires a first preset number of first images based on the target video.

[0108] As one implementation method, platform operators can retrieve the movie A (target video) to be played online from the video resource library on the platform operation terminal 720. Movie A is a horror movie. Then, the platform operation terminal 720 can send movie A to the cloud execution server 730 so that the cloud execution server 730 can generate the cover image of movie A.

[0109] Furthermore, the cloud execution server 730 can obtain the current utilization rate of its own executing tasks to determine its performance status, and then obtain a first preset number of first images based on the performance status. For example, when the cloud execution server 730 obtains that its own executing task utilization rate is 70%, it can extract one frame of movie A (first image) every 1 second. If the task utilization rate is 50%, it can extract one frame of movie A every 0.6 seconds. The first preset number can be determined by the interval between the cloud execution server 730 extracting the first images.

[0110] (2) The computer device obtains a second preset number of second images from a first preset number of first images according to the image clarity filtering rules.

[0111] In one implementation, after selecting a first image from a target video, the computer device can use a sharpness detection algorithm to perform sharpness detection on each first image, calculate the sharpness of each first image, sort a first preset number of first images in descending order according to the numerical value of the sharpness, and then select Top-k (k is a second preset number) first images from the sorted list as second images.

[0112] For example, the cloud execution server 730 can execute a sharpness detection algorithm to calculate the sharpness of each first image. This sharpness detection algorithm is based on the Laplacian operator to calculate the second derivative of the image to reflect the edge information of the image, thereby determining the sharpness of the image. The sharpness detection algorithm can be written in Python, and the core code is shown below:

[0113] (3) The computer device determines the background image from the second preset number of second images according to the image filtering rules.

[0114] The background image needs to carry facial information in order to obtain the emotional features of the face. To this end, the computer device can use object detection algorithms to determine whether each second image carries facial information, and then determine the background image from at least one second image carrying facial information.

[0115] In one implementation, the step of the computer device determining a background image from a second preset number of second images according to image filtering rules may include: (3.1) The computer equipment performs target detection on each second image separately.

[0116] (3.2) When the computer device detects that at least one second image carries facial information, it performs image filtering on at least one second image according to the image filtering rules to obtain the background image.

[0117] (3.3) When the computer device detects that each second image does not carry facial information, it returns to the step of obtaining a first preset number of first images based on the target video.

[0118] For example, an object detection algorithm can be used to perform object detection on each second image to determine whether the detected second image carries facial information. When at least one second image is detected to carry facial information, image filtering can be performed on each second image carrying facial information according to image filtering rules to obtain a background image.

[0119] For example, the cloud execution server 730 can use Faster-RCNN (Regions with Convolutional Neural Network Features) or YOLO (You Only Look Once) algorithms to perform object detection on each second image, calculate the second area ratio of the face region in each second image, and use the second image with the second area ratio closest to the optimal ratio as the background image. When it is detected that no face information is carried in each second image, the cloud execution server 730 can re-execute the step of obtaining a first preset number of first images based on the target video, and then select a new first preset number of first images from the target video.

[0120] Step S220: The computer device performs emotion recognition on the background image to determine the emotional features corresponding to the facial information.

[0121] As one implementation method, a computer device can construct an emotion recognition training task based on training set data (facial sample images) to obtain an emotion recognition model. This emotion recognition model can identify the emotional features of a face, including anger, aversion, fear, happiness, neutrality, sadness, and surprise. For example, a cloud execution server 730 can use YOLOv5 to perform emotion recognition on a background image and determine that the emotional feature corresponding to the facial information in the background image is "fright".

[0122] Step S230: The computer device obtains the first area ratio of the portrait area where the person information is located in the background image.

[0123] For example, the cloud execution server 730 can detect the area of ​​the person information in the background image and its proportion of the background image area using an object detection algorithm. For instance, it can use Faster-RCNN or YOLO algorithms to detect the person image area in the background image and calculate the proportion of the area of ​​the person image area to the area of ​​the background image.

[0124] Step S240: The computer device determines the location of the text area based on the comparison result between the first area ratio and the preset ratio.

[0125] In the cover design process, the visual presentation of the cover is achieved by layering different layers in a specific order. The text area can be determined based on the proportion of the background image occupied by the area containing the person's information.

[0126] In some embodiments, the step of determining the location of the text area based on a comparison between a first area proportion and a preset proportion may include: (1) When the first area ratio is greater than the preset ratio, the computer device determines the face region of each face information and determines the text region based on each face region.

[0127] (2) When the first area ratio is not greater than the preset ratio, the computer device determines the text area based on the area where the person information is located.

[0128] As one implementation method, the computer device can detect the first area ratio of the background image where the person information is located in the background image through the target detection algorithm. Then, when the first area ratio is not greater than the preset ratio, the computer device can determine the area outside the background image where the person information is located as the text area.

[0129] In another implementation, after the computer device detects the area of ​​the person information in the background image by the target detection algorithm and occupies a first area of ​​the background image, when the first area proportion is calculated to be greater than a preset proportion, the computer device can determine the face area of ​​each face information, and then determine the area in the background image that does not contain all face areas as the text area.

[0130] like Figure 9 As shown, the cloud execution server 730 uses the YOLO algorithm to detect two figures in the background image 830 of movie A, and calculates that the area 840 where the two figures are located occupies a first area of ​​the background image 830 that is greater than a preset percentage. Then, it determines the face regions 810 and 820 of the two faces respectively, and determines the area in the background image 830 that does not contain the face regions 810 and 820 as the text area (shadow area).

[0131] In other embodiments, when the first area ratio is not greater than a preset ratio, the computer device can determine multiple image regions in the background image other than the human image region, and obtain the color variance of each image region. The color variance is used to characterize the state of color change in the image region. Then, the computer device can use the image region whose color variance is within the preset range of variance as the text region.

[0132] Step S250: The computer device acquires the spatial information of the text area.

[0133] In one implementation, after determining the text area, the computer device can obtain the width and length of the text area, and then calculate the aspect ratio of the text area, as well as obtain the center point of the text area, and determine the relative position of the text area on the background image based on the coordinates of the center.

[0134] Step S260: The computer device determines the target text image from the text library based on spatial information and emotional features.

[0135] The text library stores preset text images, which are pre-designed by professionals. Each preset text image has corresponding size information (e.g., image length and width) and a sentiment tag. Optionally, the sentiment tags for the preset text images can be automatically assigned using a deep neural network model.

[0136] In some embodiments, the computer device can vectorize the text to obtain the corresponding word embeddings, and then use a deep neural network or logistic regression to train the network to automatically annotate the unannotated text. Optionally, the output layer of the sentiment classification model can use a Softmax layer to obtain the sentiment classification probability distribution of the text.

[0137] In other embodiments, the computer device can train a model for sentiment classification of text images based on the text images. For example, it can train the text images on sentiment based on a convolutional neural network (CNN) to automatically label unlabeled text images.

[0138] For example, the cloud training server 710 can acquire a training dataset, which includes text training images and real sentiment labels associated with the text training images. Furthermore, the cloud training server 710 can train a pre-defined label neural network based on the text training images and real sentiment labels until the pre-defined label neural network meets pre-defined conditions, thus obtaining the trained label model.

[0139] It should be noted that the preset conditions can be: the total loss value of the target loss function is less than a preset value, the total loss value of the target loss function no longer changes, or the number of training iterations reaches a preset number, etc. Optionally, an optimizer can be used to optimize the target loss function, and the learning rate, batch size, and epoch can be set based on experimental experience.

[0140] Furthermore, the cloud training server 710 can input multiple unlabeled preset text images into the labeling model, so that each preset text image is associated with a corresponding sentiment label.

[0141] As one implementation method, the step of the computer device determining a target text image from a text library based on spatial information and emotional features may include: (1) The computer device matches the emotional features with the emotional tags of each preset copy image in the copy library to obtain the emotional image.

[0142] (2) The computer equipment filters the emotional image based on the spatial information of the text area to obtain the intermediate text image.

[0143] (3) The computer equipment performs image processing on the intermediate text image based on the color information of the background image to obtain the target text image.

[0144] For example, the computer device uses preset text images whose emotional tags and emotional features match in the text library as emotional images. For instance, the cloud execution server 730 obtains that the emotional feature of the facial information in the background image corresponding to movie A is "frightened," and then searches the text library for preset text images whose emotional tags match "frightened" as emotional images. Further, the first size information of each emotional image is matched with spatial information. When the first size information is the same as the second size information indicated by the spatial information, the computer device determines the emotional image as an intermediate text image.

[0145] When the first size information differs from the second size information indicated by the spatial information, the computer device adjusts the first size information of the emotional image to the second size information and determines the size-adjusted emotional image as the intermediate text image. Furthermore, the computer device can obtain the average hue value, saturation, and brightness of the background image, and adjust the hue value, saturation, and brightness of the intermediate text image based on the average hue value, saturation, and brightness of the background image, using the adjusted intermediate text image as the target text image.

[0146] For example, the cloud execution server 730 obtains the color information (hue, saturation, and brightness) of the cool-toned background image of movie A, and then adjusts the hue, saturation, and brightness of the intermediate text image based on this cool-toned color information, so that the color information of the intermediate text image matches the horror theme of movie A.

[0147] Step S270: The computer device displays the target text image within the text area, thus obtaining a target text area containing the target text image.

[0148] Step S280: The computer device generates the cover image of the target video based on the layer where the background image is located and the layer where the target text image is located.

[0149] For example, such as Figure 10 As shown, after acquiring the target text image 910, the cloud execution server 730 can display the target text image 910 within the text area 920, thereby obtaining a target text area containing the target text image. Further, as... Figure 11 As shown, the cloud execution server 730 synthesizes the cover image 1000 of the target video by overlaying the background image on layer 1010 and the target text image on layer 1020.

[0150] Please see Figure 12 , Figure 12 A flowchart of a video cover generation task is shown. In a specific embodiment, this video cover generation task can utilize, for example... Figure 8 In the video cover generation scenario shown, specifically, after the platform operator 720 obtains the target video, it sends the target video to the cloud execution server 730. The cloud execution server 730 can extract a first preset number of first images frame by frame from the target video, and then filter the first preset number of first images by clarity to obtain a second preset number of second images.

[0151] Furthermore, the cloud execution server 730 performs image filtering on the second preset number of second images to obtain a background image with facial information, and performs emotion recognition on the facial information to obtain the emotional features corresponding to the faces in the background image. Further, the cloud execution server 730 determines the text area based on the person information in the background image, and retrieves the target text image from the text library based on the emotional features, then displays the target text image in the text area, thereby generating the cover image of the target video based on the layers where the background image and the target text image are located.

[0152] In this embodiment, a background image can be selected based on the target video, and emotion recognition can be performed on the background image to determine the emotional features corresponding to the facial information. The first area ratio of the image region containing the person's information in the background image is obtained. Further, based on the comparison result between the first area ratio and a preset ratio, the position of the text region is determined. Within the text region, a target text image matching the emotional features is generated based on a text library, resulting in a cover image generated from the target text image and the background image. Thus, a background image containing facial information can be selected from the target video. Based on the obtained facial emotional features, a text image matching the facial emotional features is displayed on the text region of the background image. Subsequently, a cover image corresponding to the target video is automatically generated based on the background image and the text image, thereby shortening the design cycle and greatly improving the design efficiency of the cover image.

[0153] Please see Figure 13 The diagram illustrates a structural block diagram of an image generation apparatus 1100 provided in an embodiment of this application. The image generation apparatus 1100 includes: an image selection module 1110, used to select a background image based on a target video, the background image carrying facial information; an emotion recognition module 1120, used to perform emotion recognition on the background image to determine the emotional features corresponding to the facial information; a proportion acquisition module 1130, used to acquire a first area proportion of the portrait area containing the person information in the background image; a region determination module 1140, used to determine the position of a text area based on a comparison result between the first area proportion and a preset proportion, the layer containing the text area covering the layer containing the background image; and a cover generation module 1150, used to generate a target text image matching the emotional features within the text area based on a text library, obtaining a cover image generated from the target text image and the background image.

[0154] In some embodiments, the cover generation module 1150 may include: an emotion matching unit, configured to match emotion features with the emotion tags of each preset text image in the text library to obtain an emotion image; an image filtering unit, configured to filter the emotion images based on the spatial information of the text area to obtain an intermediate text image; an image processing unit, configured to perform image processing on the intermediate text image according to the color information of the background image to obtain a target text image; a region determination unit, configured to display the target text image within the text area to obtain a target text area containing the target text image; and a cover generation unit, configured to generate a cover image of the target video based on the layer where the background image is located and the layer where the target text image is located.

[0155] In some embodiments, the image filtering unit may be specifically configured to: match the first size information of each emotional image with spatial information; when the first size information of the emotional image is the same as the second size information indicated by the spatial information, determine the emotional image as an intermediate text image; when the first size information of the emotional image is different from the second size information indicated by the spatial information, adjust the first size information of the emotional image to the second size information, and determine the size-adjusted emotional image as an intermediate text image.

[0156] In some embodiments, the image generation apparatus 1100 may further include: a data acquisition module for acquiring a training dataset, the training dataset including text training images and real sentiment labels associated with the text training images; a network training module for training a preset label neural network based on the text training images and real sentiment labels until the preset label neural network meets preset conditions, thereby obtaining a trained label model; and a label output module for inputting multiple unlabeled preset text images into the label model and outputting the sentiment label corresponding to each preset text image through the label model.

[0157] In some embodiments, the region determination module 1140 may be specifically used to: determine the face region of each portrait region when the first area ratio is greater than the preset ratio, and determine the position of the text region based on each face region; when the first area ratio is not greater than the preset ratio, determine the position of the text region based on the position of the portrait region.

[0158] In some embodiments, the region determination module 1140 may also be specifically used to: when the first area ratio is not greater than a preset ratio, determine multiple image regions in the background image other than the human portrait region; obtain the color variance of each image region, the color variance being used to characterize the state of color change in the image region; and use the image region whose color variance is within the preset range of variance as the text region.

[0159] In some embodiments, the image selection module 1110 may include: a first image acquisition unit, configured to acquire a first preset number of first images based on a target video; a second image acquisition unit, configured to acquire a second preset number of second images from the first preset number of first images according to an image clarity filtering rule, wherein the second preset number is less than the first preset number; and a background image determination unit, configured to determine a background image from the second preset number of second images according to an image filtering rule.

[0160] In some embodiments, the background image determination unit may include: a detection subunit, configured to perform target detection on each second image respectively; an acquisition subunit, configured to perform image filtering on at least one second image according to image filtering rules to acquire a background image when at least one second image is detected to carry facial information; and a return subunit, configured to return to the step of acquiring a first preset number of first images based on the target video when each second image is detected not to carry facial information.

[0161] In some embodiments, the image filtering rules include at least an area ratio filtering rule, and the acquisition subunit may be specifically used to: acquire the second area ratio of the face region of the face information in at least one second image; perform image filtering on at least one second image according to the second area ratio and the area ratio filtering rule to acquire a background image.

[0162] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0163] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0164] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0165] The solution provided in this application can select a background image based on a target video, perform emotion recognition on the background image to determine the emotional features corresponding to facial information, and obtain the first area ratio of the image region containing the person's information in the background image. Further, based on the comparison result between the first area ratio and a preset ratio, the position of the text region is determined, and within the text region, a target text image matching the emotional features is generated based on a text library, resulting in a cover image generated from the target text image and the background image. In this way, a background image containing facial information can be selected from the target video, and based on the obtained facial emotional features, a text image matching the facial emotional features is displayed on the text region of the background image. Then, a cover image corresponding to the target video is automatically generated based on the background image and the text image, thereby shortening the design cycle and greatly improving the design efficiency of the cover image.

[0166] like Figure 14As shown in the figure, this application embodiment also provides a computer device 1200, which includes a processor 1210, a memory 1220, a power supply 1230, and an input unit 1240. The memory 1220 stores computer program instructions. When the computer program instructions are called by the processor 1210, they can execute various method steps provided in the above embodiments. Those skilled in the art will understand that the structure of the computer device shown in the figures does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: Processor 1210 may include one or more processing cores. Processor 1210 connects to various parts of the entire battery management system using various interfaces and lines. It executes instructions, programs, code sets, or instruction sets stored in memory 1220, calls data stored in memory 1220, performs various functions and processes data within the battery management system, and performs various functions and processes data within the computer device, thereby providing overall control of the computer device. Optionally, processor 1210 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 1210 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understandable that the aforementioned modem may not be integrated into the processor 1210, but may be implemented using a separate communication chip.

[0167] The memory 1220 may include random access memory (RAM) or read-only memory (ROM). The memory 1220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 1220 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described below, etc. The data storage area may also store data created during the use of the computer device (such as phonebook and audio / video data). Accordingly, the memory 1220 may also include a memory controller to provide the processor 1210 with access to the memory 1220.

[0168] The power supply 1230 can be logically connected to the processor 1210 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 1230 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0169] The input unit 1240 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0170] Although not shown, the computer device 1200 may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 1210 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 1220 according to the following instructions, and the processor 1210 runs the applications stored in the memory 1220, thereby implementing the various method steps provided in the foregoing embodiments.

[0171] like Figure 15 As shown, this application embodiment also provides a computer-readable storage medium 1300, which stores computer program instructions 1310, which can be called by a processor to execute the methods described in the above embodiments.

[0172] Computer-readable storage media can be electronic storage devices such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, computer-readable storage media include non-volatile computer-readable storage medium. Computer-readable storage medium 1300 has storage space for program code that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code can be compressed, for example, in a suitable form.

[0173] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.

[0174] The above are merely preferred embodiments of this application and are not intended to limit this application in any way. Although this application has disclosed preferred embodiments as above, it is not intended to limit this application. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the technical solution of this application. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of this application without departing from the scope of the technical solution of this application shall still fall within the scope of the technical solution of this application.

Claims

1. An image generation method, characterized in that, The method includes: A background image is selected based on the target video, and the background image carries facial information; Emotion recognition is performed on the background image to determine the emotional features corresponding to the facial information; The percentage of the area of ​​the person's portrait region within the background image is determined. Based on the comparison result between the first area ratio and the preset ratio, the position of the text area is determined, and the layer where the text area is located covers the layer where the background image is located; wherein, when the first area ratio is greater than the preset ratio, the face area of ​​each portrait area is determined, and the position of the text area is determined based on each face area; when the first area ratio is not greater than the preset ratio, the position of the text area is determined based on the position of the portrait area. The emotional features are matched with the emotional tags of each preset text image in the text library to obtain an emotional image; the text library is used to store preset text images, which are pre-designed text images, and each preset text image has a corresponding emotional tag, which corresponds to the emotional features of a human face; The emotional image is filtered based on the spatial information of the text area to obtain an intermediate text image; The intermediate text image is processed based on the color information of the background image to obtain the target text image; The target text image is displayed within the text area to obtain a target text area containing the target text image; The cover image of the target video is generated based on the layer where the background image is located and the layer where the target text image is located.

2. The method according to claim 1, characterized in that, The step of filtering the emotional image based on the spatial information of the text region to obtain an intermediate text image includes: The first size information of each emotional image is matched with the spatial information; When the first size information of the emotional image is the same as the second size information indicated by the spatial information, the emotional image is determined as the intermediate text image; When the first size information of the emotional image is different from the second size information indicated by the spatial information, the first size information of the emotional image is adjusted to the second size information, and the size-adjusted emotional image is determined as the intermediate text image.

3. The method according to claim 1, characterized in that, The emotional tag for each preset text image in the text library is obtained through the following steps: Obtain a training dataset, which includes text training images and real sentiment labels associated with the text training images; The preset label neural network is trained based on the text training images and the real emotion labels until the preset label neural network meets the preset conditions, and the trained label model is obtained. Multiple unlabeled preset text images are input into the labeling model, and the labeling model outputs the emotion label corresponding to each preset text image.

4. The method according to claim 1, characterized in that, The step of determining the location of the text area based on the matching result of the first area ratio and the preset ratio further includes: When the first area ratio is not greater than the preset ratio, multiple image regions other than the human figure region in the background image are determined; Obtain the color variance of each image region, whereby the color variance is used to characterize the state of color change in the image region; Image regions whose color variance falls within a preset variance range are designated as text regions.

5. The method according to claim 1, characterized in that, The selection of background images based on the target video includes: Obtain a first preset number of first images based on the target video; According to the image clarity filtering rules, a second preset number of second images are obtained from the first preset number of first images, where the second preset number is less than the first preset number. According to the image filtering rules, a background image is determined from the second preset number of second images.

6. The method according to claim 5, characterized in that, The step of determining the background image from the second preset number of second images according to the image filtering rules includes: Perform target detection on each second image separately; When at least one second image is detected to carry facial information, image filtering is performed on the at least one second image according to image filtering rules to obtain a background image; When it is detected that each second image does not carry facial information, return to the step of obtaining a first preset number of first images based on the target video.

7. The method according to claim 6, characterized in that, The image filtering rules include at least area ratio filtering rules, and the step of filtering the at least one second image according to the image filtering rules to obtain a background image includes: Obtain the second area ratio of the face region in the face information of the at least one second image; Image filtering is performed on the at least one second image according to the second area ratio and the area ratio filtering rule to obtain a background image.

8. An image generation apparatus, characterized in that, The device includes: The image selection module is used to select a background image based on the target video, wherein the background image carries facial information; An emotion recognition module is used to perform emotion recognition on the background image and determine the emotional features corresponding to the facial information. The proportion acquisition module is used to obtain the first area proportion of the portrait area where the person information is located in the background image; The region determination module is used to determine the position of the text region based on the comparison result of the first area ratio and the preset ratio, wherein the layer where the text region is located covers the layer where the background image is located; wherein, when the first area ratio is greater than the preset ratio, the face region of each portrait region is determined, and the position of the text region is determined based on each face region; when the first area ratio is not greater than the preset ratio, the position of the text region is determined based on the position of the portrait region. The cover generation module is used to match the emotional features with the emotional tags of each preset text image in the text library to obtain an emotional image; the text library is used to store preset text images, which are pre-designed text images, each of which has a corresponding emotional tag, and the emotional tag corresponds to the emotional features of a human face; the emotional images are filtered based on the spatial information of the text area to obtain intermediate text images; the intermediate text images are processed according to the color information of the background image to obtain a target text image; the target text image is displayed in the text area to obtain a target text area containing the target text image; and the cover image of the target video is generated according to the layer where the background image is located and the layer where the target text image is located.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code that can be invoked by a processor to execute the method as described in any one of claims 1 to 7.

10. A computer device, characterized in that, include: Memory; One or more processors are coupled to the memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the method as described in any one of claims 1 to 7.

11. A computer program product or computer program, characterized in that, The computer program product or computer program includes computer instructions stored in a storage medium; the processor of the computer device reads the computer instructions from the storage medium and executes the computer instructions, causing the computer to perform the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image generation method and device, storage medium and equipment

    CN114529635A

  • Intelligent portrait composition method and device

    CN114611589A