Method, device, electronic device and storage medium for generating a video
By providing a method and apparatus for receiving input information to convert images, determine story text, and allow users to modify characters, the problem of needing multiple applications for video production is solved, enabling a convenient video generation and modification process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
- Filing Date
- 2024-08-23
- Publication Date
- 2026-05-01
AI Technical Summary
Creating videos requires the use of multiple applications and takes a lot of time and effort.
A method and apparatus for generating videos are provided, which receive input information, convert an input image into an image of a target style, determine story text, generate an initial video, and allow users to modify characters to generate a target video.
It simplifies the video production process, allowing users to generate and modify videos using a single application. The operation is convenient and reduces the time and effort required.
Smart Images

Figure CN119031211B_ABST
Abstract
Description
Methods, apparatus, electronic devices and storage media for generating video Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to the fields of large language models, generative models, and image processing. More specifically, this disclosure provides a method, apparatus, electronic device, storage medium, and computer program product for generating video. Background Technology
[0002] In both work and daily life, users sometimes want to create videos. However, creating videos often requires using multiple applications and consumes a significant amount of time and effort. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, storage medium, and computer program product for generating video.
[0004] According to one aspect of this disclosure, a method for generating a video is provided, comprising: in response to receiving input information, converting N input images in the input information into N images conforming to a target style in the input information; N being an integer greater than or equal to 1; determining story text based on the N input images; wherein the story text includes N sub-texts corresponding to the N images; determining an initial video based on the N images and the N sub-texts; wherein the initial video includes multiple pages, each page including images and sub-texts; and in response to determining a modification operation for characters in a target page among the multiple pages, updating the initial video based on the character attributes of the modified characters or the page image of the modified target page to obtain a target video; wherein the characters include sub-texts in the target page.
[0005] According to another aspect of this disclosure, an apparatus for generating video is provided, comprising: a conversion module, a story determination module, an initial video determination module, and an update module. The conversion module is configured to, in response to receiving input information, convert N input images in the input information into N images conforming to a target style in the input information; N is an integer greater than or equal to 1. The story determination module is configured to determine story text based on the N input images; wherein the story text includes N sub-texts corresponding to the N images. The initial video determination module is configured to determine an initial video based on the N images and the N sub-texts. The initial video includes multiple pages, each page including images and sub-texts. The update module is configured to, in response to determining a modification operation for characters in a target page among the multiple pages, update the initial video based on the character attributes of the modified characters or the page image of the modified target page, to obtain a target video; wherein the characters include sub-texts in the target page.
[0006] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the methods provided in this disclosure.
[0007] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the methods provided in this disclosure.
[0008] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the methods provided in this disclosure.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0011] Figure 1 is a schematic diagram of an application scenario of the method and apparatus for generating video according to an embodiment of the present disclosure;
[0012] Figure 2 is a schematic diagram of the architecture of a video generation system according to an embodiment of the present disclosure;
[0013] Figure 3 is a schematic flowchart of a method for generating video according to an embodiment of the present disclosure;
[0014] Figure 4 is a schematic flowchart of a method for generating video according to another embodiment of the present disclosure;
[0015] Figure 5A is a schematic diagram of front-end modification of characters in a video according to an embodiment of the present disclosure;
[0016] Figure 5B is a video page diagram generated based on the modified characters according to an embodiment of the present disclosure;
[0017] Figure 6 is a schematic flowchart of triggering video generation operation according to an embodiment of the present disclosure;
[0018] Figure 7 is a schematic flowchart of the style selection according to an embodiment of the present disclosure;
[0019] Figure 8 is a schematic flowchart of uploading images according to an embodiment of the present disclosure;
[0020] Figure 9 is a schematic flowchart of video generation based on input information according to an embodiment of the present disclosure;
[0021] Figure 10 is a schematic flowchart of video playback according to an embodiment of the present disclosure;
[0022] Figure 11 is a schematic structural block diagram of a video generation apparatus according to an embodiment of the present disclosure; and
[0023] Figure 12 is a structural block diagram of an electronic device used to implement the video generation method of the present disclosure embodiments. Detailed Implementation
[0024] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0025] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0026] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.
[0027] Figure 1 is a schematic diagram of an application scenario of the method and apparatus for generating video according to an embodiment of the present disclosure.
[0028] It should be noted that Figure 1 is only an example of a system architecture that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but it does not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0029] As shown in Figure 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0030] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0031] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as an initial video generated based on the user's uploaded input image, selected style, and input theme, or a target video generated based on the user's modification operations) to the terminal devices.
[0032] It should be noted that the video generation method provided in this disclosure embodiment can generally be executed by server 105. Correspondingly, the video generation apparatus provided in this disclosure embodiment can generally be located in server 105. The video generation method provided in this disclosure embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the video generation apparatus provided in this disclosure embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.
[0033] It should be understood that the number of terminal devices, networks, and servers shown in Figure 1 is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0034] Figure 2 is a schematic diagram of the architecture of a video generation system according to an embodiment of the present disclosure.
[0035] This embodiment provides a video generation system, which may include a client 201, an intermediate server 202, a task scheduling center 203, and a video generation terminal 204. The client 201 is a front-end electronic device, while the intermediate server 202, the task scheduling center 203, and the video generation terminal 204 are all back-end electronic devices. The intermediate server 202, the task scheduling center 203, and the video generation terminal 204 can be integrated into one server or deployed on different servers.
[0036] During video generation, the user can input information through the client 201's interface. This input information may include at least one uploaded input image, the selected style, and the theme. The client 201 then transmits the input information to the intermediate server 202. The intermediate server 202 transmits the input information to the task scheduling center 203 and requests task creation. The task scheduling center 203 can assign a task identifier to the task and return it to the intermediate server 202. The intermediate server 202 can create a file and associate it with the task identifier. Furthermore, the intermediate server 202 can return the task identifier to the client 201, allowing the client 201 to enter a generation waiting page to prompt the user to wait.
[0037] The video generator 204 can retrieve tasks from the task scheduling center 203. During the task retrieval process, it acquires input information and then generates an initial video based on the input information. In addition, after generating the video, the video generator 204 can directly transmit the video to the client 201, or return the initial video to the client 201 via the task scheduling center 203 and intermediate server 202.
[0038] In addition, the video generation terminal 204 can also notify the task scheduling center 203 of the task progress. The task progress can include whether the task is completed or not. After the task is completed, the video generation terminal 204 returns the generated initial video to the task scheduling center 203. After receiving the task progress, the task scheduling center 203 can notify the video generation terminal 204 of the task progress.
[0039] The above describes the video generation system, whose architecture can be applied to scenarios such as video production and comic creation.
[0040] Figure 3 is a schematic flowchart of a method for generating video according to an embodiment of the present disclosure.
[0041] As shown in Figure 3, the method 300 for generating video may include operations S310 to S340.
[0042] In operation S310, in response to receiving input information, the N input images in the input information are converted into N images that conform to the target style in the input information; N is an integer greater than or equal to 1.
[0043] For example, a user can input the above input information through the operation interface of the first electronic device at the front end, and then the front-end electronic device will transmit the acquired input information to the second electronic device that executes the video generation method. The first electronic device is, for example, a client, and the second electronic device is, for example, implemented through a server. The second electronic device can be, for example, the video generation end mentioned above.
[0044] For example, users can upload one or more input images using the front-end interface. Users can also input or select a target style using the front-end interface; the target style refers to the style of the input image after conversion, such as cartoon style, refined style, retro style, etc. In some embodiments, the input information may also include a theme. Users can input or select a theme through the front-end interface. The theme can be the theme of the story described in the initial video to be generated, for example, the theme is "A Happy Journey." In some embodiments, users can leave the theme blank.
[0045] In some embodiments, a diffusion model can be used to generate a style-transformed image. For example, multiple diffusion models can be pre-trained, each corresponding to a specific image style. The diffusion model that matches the target style can be determined from among the multiple models, and then the input image can be fed into that diffusion model, which will then output the style-transformed image.
[0046] In operation S320, the story text is determined based on N input images; wherein the story text includes N sub-texts corresponding to the N images.
[0047] For example, image understanding can be performed on the input images to obtain their semantic information. This semantic information can include at least one of descriptive text and labels. The descriptive text describes the image content of N input images, and the labels are text describing the features of the objects. A story text can be expanded using a large model based on at least one of the descriptive text, labels, and topics.
[0048] For example, a story text may consist of N subtexts. The story text can be segmented into sentences, dividing one or more sentences into a subtext, thus creating N subtexts. These N subtexts have an order, representing their sequence within the story text. Furthermore, each of the N subtexts corresponds one-to-one with one of the N images; for example, the content described by the subtext is related to the content described by the image.
[0049] For example, a user inputs the theme "childhood memories," and two images are input. The first image contains a girl and a house, while the second image contains a cat and a dog. The story text could be "A girl sits in front of the house, watching the cat and dog chase and play." One subtext is "A girl sits in front of the house," corresponding to the first image, and the other is "Watching the cat and dog chase and play," corresponding to the second image. Understandably, the only difference between the input images is the style transformation; the substantive content remains unchanged. Therefore, if a subtext corresponds to a particular input image, then that subtext will also correspond to the image obtained after style transformation from that input image.
[0050] In operation S330, an initial video is determined based on N images and N subtexts; wherein the initial video comprises multiple pages, each page including images and subtexts.
[0051] In one example, N images can be played in the order of N subtexts, and the N subtexts can be used as subtitles for the corresponding images to obtain the initial video.
[0052] In another example, a target video template can be pre-configured. This template can include at least one of the following: transition effects between N images, background music, and subtitle attributes. The subtitle attributes can include at least one of the following: subtitle color, font, font size, and position. Furthermore, the target video template can also indicate whether the input images are displayed, and if so, the transition effects between them.
[0053] For example, taking a target video template that includes transition effects and background music as an example, N images can be played in the order of N sub-texts, and the transition effects in the target video template can be switched between the N images. The background music in the target video template can be used during the playback, thus obtaining the generated initial video.
[0054] It should be noted that the initial video comprises multiple pages. For example, if there are two input images, these two images undergo style transfer to produce two new images. The initial video will play these two input images and the two new images in sequence. Therefore, the initial video consists of four pages. Each page includes images and text. The images on a page can include the input images or the style-transferred images. The text on a page can include subtext, and may also include text such as titles and authors.
[0055] In operation S340, in response to determining a modification operation for characters in the target page among multiple pages, the initial video is updated based on the character attributes of the modified characters or the page image of the modified target page to obtain the target video.
[0056] For example, after the second electronic device generates the initial video, it can send the initial video to the first electronic device for display. Users can edit the initial video through the front-end operation interface of the first electronic device. Editing can include modifying images on the page, and can also include modifying characters on the page.
[0057] For example, the target page refers to the page in the video that is being edited, and the modification operation on the characters in the target page can include at least one of the following: modifying the content of the characters in the target page, or moving the position of the characters in the target page.
[0058] For example, character attributes can include the content, position, and style of the character; styles can include font, font size, and color. The second electronic device can acquire the character attributes obtained from the first electronic device, and then update the character attributes in the initial video with the modified character attributes, thereby updating the initial video.
[0059] For example, the page image may include an image obtained by taking a screenshot of the modified target page. The second electronic device may acquire the page image obtained by the first electronic device and then update the corresponding page in the initial video with the page image, thereby updating the initial video.
[0060] According to the technical solution provided in this disclosure, in practical applications, users can upload at least one input image and select a style to automatically generate a custom initial video. Furthermore, users can modify the characters in the initial video according to their actual needs, and the second electronic device can update the initial video accordingly based on the user's modifications. This allows users to generate and modify the initial video using a single application, eliminating the need for multiple applications, making the operation more convenient and simple, and shortening the user interaction path.
[0061] Figure 4 is a schematic flowchart of a method for generating video according to another embodiment of the present disclosure.
[0062] As shown in Figure 4, the method 400 for generating video may include operations S401 to S402 and operations S410 to S440.
[0063] In operation S401, input information is obtained, which includes N input images and styles, where N is an integer greater than or equal to 1. In addition, the input information may also include the theme.
[0064] In operation S402, image understanding is performed on the input image to obtain semantic information.
[0065] For example, semantic information can include descriptive text for the input image, which describes the image content of the input image. A graph-based text model can be used to determine the descriptive text by feeding the input image into the model and outputting the descriptive text. For instance, if the input image shows a person walking on the beach, the descriptive text for that input image could be "A girl is walking on the beach."
[0066] For example, semantic information may also include labels for at least one object included in the input image. An object may represent a person in the input image, and each of the at least one object corresponds to at least one label, which includes text describing the features of the object. For example, an input image may include two objects: one object is labeled as male, short hair, and wearing glasses, while the other object is labeled as female and long hair. For instance, an object detection model can be used to determine the labels.
[0067] In operation S410, the N input images in the input information are converted into N images that conform to the target style in the input information.
[0068] In one example, an input image can be transformed into an image conforming to a target style based on at least one label corresponding to each object. For example, a diffusion model can be used to generate the style-transformed image. Multiple diffusion models can be pre-trained, each corresponding to a different image style. The diffusion model that matches the target style can be determined from among the multiple models based on pre-configured matching relationships. The input image, label, and topic are then input into the diffusion model, which outputs the style-transformed image. In other embodiments, the topic may be missing from the information input to the diffusion model. This example obtains labels by performing image understanding on the input image and then performs style transformation based on the labels and topic. This approach ensures that the style of the transformed image is consistent with the content of the image.
[0069] In practical applications, the diffusion model can be Stable Diffusion. Furthermore, plugins such as depth and openpose can be used within the diffusion model to ensure consistency between the character's outline, skeletal structure, pose, and the input image. Plugins like facedetailer can also be used to redraw the character's face, ensuring similarity and refinement of key facial features. Additionally, YOLO (You Only Look Once) or other models can be used to determine the number of objects in the input image and differentiate scenes based on the number of objects. Scenes can include single-object and multi-object scenes. For multi-object scenes, a correspondence between labels and object locations needs to be established. Then, image regions corresponding to the locations are generated based on the labels, avoiding the confusion of features between different objects. Confusion could occur, for example, in the generated image, where some features of one character are features of other characters, rather than features of the character itself.
[0070] In operation S420, the story text is determined based on N input images; wherein the story text includes N sub-texts corresponding to the N images.
[0071] It should be noted that the target style mentioned above refers to the style of the input image after conversion, such as traditional Chinese style, minimalist style, or clay style. The copywriting style refers to the style of the story text, which may include literary, humorous, or healing styles.
[0072] In determining the target copywriting style, the target copywriting style can be determined from multiple candidate copywriting styles based on N descriptive texts. Then, using a large language model, the story text can be expanded based on the theme, N descriptive texts, and the target copywriting style, where the theme can be empty.
[0073] For example, a topic, N descriptive texts, and a first prompt template can be combined into input text. This input text is then fed into a large language model to obtain the target copywriting style. The first prompt template is a piece of natural language text, used to define the task of the large language model. For instance, the first prompt template includes multiple candidate copywriting styles, and the prompt template represents the task that the large model needs to perform: selecting the target copywriting style from multiple candidate styles based on the topic and N descriptive texts.
[0074] In the process of determining the story text based on the target style, the theme, N descriptive texts, target copywriting style, and second prompt information template can be combined into another input text. This input text is then fed into a large language model, which expands it to obtain the story text.
[0075] For example, the second cue message template is a piece of natural language text. The cue message template is used to define the task of the large language model. For example, the second cue message template includes multiple candidate copywriting styles, and the cue message template represents the task that the large model needs to perform, including: generating a logical story based on a topic and N descriptive texts, the story conforming to the topic, and the plot of the story being related to the N descriptive texts.
[0076] This embodiment uses a large language model to determine the target copywriting style and generate story text, which can convert N descriptive texts into story texts that conform to the theme and ensure the logical consistency of the story texts.
[0077] In operation S430, an initial video is determined based on N images and N subtexts; wherein the initial video comprises multiple pages, each page including images and subtexts.
[0078] In operation S440, in response to determining a modification operation for characters in a target page among multiple pages, the initial video is updated according to the character attributes of the modified characters or the page image of the modified target page to obtain the target video; wherein, the characters include subtext in the target page.
[0079] It should be noted that after the initial video is generated, users can edit it according to their actual needs. Editing can include modifying characters on the page. Modified characters can include subtext in the story text, as well as text information such as the title and author.
[0080] Figure 5A is a schematic diagram of front-end modification of characters in a video according to an embodiment of the present disclosure, and Figure 5B is a video page diagram generated based on the modified characters according to an embodiment of the present disclosure.
[0081] As shown in Figure 5A, the pages in the video can be displayed through the front-end interface. The characters on the page can be titles, authors, and subtext. Additionally, markers can be used around the characters; these markers can be dashed borders. Users can drag the markers to change the position of the characters and modify their content. As shown in Figure 5B, after the user modifies the characters on the page, the initial video needs to be updated, and the markers in the updated target video page need to be removed, such as the aforementioned dashed borders. Furthermore, the display style of the page corners can be modified. For example, the corners of the page displayed in the front-end interface can be rounded. In this case, the style of the outermost DOM can be controlled through the `style` parameter; passing the parameter `borderRadius:0` will convert the rounded corners to right angles.
[0082] It's important to note that while the browser can automatically control the number of characters per line and wrap lines automatically when characters are long, the backend lacks this automatic line wrapping functionality. Therefore, if all characters on the same page are treated as a single unit and the absolute coordinates of a reference point (e.g., the top left corner) are sent to the backend, the characters may exceed the container's capacity when the video is generated. This can result in the video containing some characters but missing others.
[0083] This disclosure provides two methods for updating the initial video to prevent characters from exceeding the display area of the target video, ensuring that the target video can display characters correctly and that the position and line breaks of the characters in the target video are consistent with the position and line breaks of the user-edited text. One method updates the initial video based on the character attributes of the modified characters, and the other method updates the initial video based on the page images of the modified target page. These two methods will be explained below.
[0084] This embodiment describes a method for updating the initial video based on the character attributes of the modified characters.
[0085] It should be noted that the character attributes of the modified characters can be determined through the editor. For example, the character attributes of the modified characters can include the coordinates of the characters in the backend, the content of the characters, the style of the characters, etc. The coordinates of the characters in the backend can include, for example, the coordinates of each character in the backend, the coordinates of each line of characters in the backend, etc.
[0086] It should be noted that in actual deployment, the editor can be deployed on the first front-end electronic device, where it determines the character attributes of the modified characters and then sends them to the second back-end electronic device. Alternatively, the editor can be deployed on the second back-end electronic device, where the first electronic device sends relevant information from the front-end operation page to the second back-end electronic device, and then the editor determines the character attributes of the modified characters.
[0087] Next, we will explain the process by which the editor determines the character attributes of the modified characters.
[0088] First, for each character on the target page, determine the coordinates of that character. For example, since the coordinates of a single character cannot be calculated using the `dom.getBoundingClientRect` method, you can manipulate the DOM element using JavaScript, extract its `innerText`, and then iterate through each character and wrap it in a `<innerText>` object. Within the tag, the coordinates of each character can be determined using the dom.getBoundingClientRect method, and the coordinates can include the horizontal and vertical coordinates.
[0089] Next, based on the coordinates of each character, the coordinates of at least one line of characters on the target page can be determined. For example, the coordinates of each character can be iterated, characters with the same vertical coordinate can be grouped into the same line, and the horizontal coordinate of the first character in a line can be determined as the horizontal coordinate of that line.
[0090] Next, based on the target adjustment ratio, the target page's size on the front end, and the coordinates of at least one line of characters on the target page, the coordinates of the characters in the back end can be determined. It's important to note that for the target page, its aspect ratio on the front end is the same as its aspect ratio on the back end, but the target page's size on the front end is generally different from the image's size on the target page, and the ratio between these two sizes is the target adjustment ratio. Therefore, based on the target page's size on the front end and the coordinates of the characters in the target page, the relative coordinates of the characters on the target page during front-end display can be determined. Then, based on the target adjustment ratio, the target page's size can be enlarged or reduced, and the coordinates of the characters in the back end can be calculated based on the relative coordinates. These coordinates can be absolute coordinates. After obtaining the coordinates of each line of characters in the back end, key-value pairs or arrays can be constructed to record the correspondence between the horizontal and vertical coordinates of each line of characters and the characters themselves.
[0091] This embodiment utilizes an editor to determine the coordinates of characters in the backend and updates the initial video based on these coordinates. This prevents characters from exceeding the display range of the target video, ensuring that the target video displays characters correctly. Furthermore, during the initial video update process, if the user edits a target page, which has a corresponding identifier, the initial video data can be traversed to find this identifier, and then the relevant data corresponding to that identifier can be read and updated. This avoids the need for a full update, thus saving resources.
[0092] The above explains how to update the initial video based on the character attributes of the modified characters.
[0093] This embodiment describes a method for updating the initial video based on the modified target page's image.
[0094] For example, during front-end display, the page in the video can include image characters and markers indicating the area where the characters are located. The image can serve as the background image of the target page, and the markers can be text boxes surrounding the characters. Users can then edit these elements, such as dragging the markers to change the position of the characters or altering their content. Accordingly, the modified target page includes the image, characters, and markers.
[0095] Next, the marker symbols can be removed from the target page to obtain the processed page. A screenshot of the processed page is then taken, and the modified target page image is determined based on the screenshot. It can be seen that the page includes marker symbols during the front-end display process. This embodiment first removes the marker symbols and then takes a screenshot of the processed page. This removes the marker symbols from the screenshot image, which can then be used to replace some image frames in the initial video, thereby updating the initial image. This method also avoids characters exceeding the display range of the target video, ensuring that the target video can display characters correctly, and keeping the position and line breaks of the characters in the target video consistent with the position and line breaks of the user-edited text. This method is suitable for backends that do not support direct character modification, using screenshot functionality to meet the user's need to modify characters.
[0096] Next, the process of removing the marker symbols from the target page will be explained.
[0097] In one example, both characters and tags in the target page can be set as elements in the target page, and the elements of the characters and tags can be made sibling elements. Then, the elements of the tags can be deleted from the target page to obtain the processed page.
[0098] It's important to note that the marker can be the border surrounding the character. If the marker is used as the parent element and the characters inside it as child elements, deleting the parent element will cause the child elements to be deleted as well. Therefore, this embodiment does not use the parent element's border property to implement the marker. Instead, it uses a separate absolutely positioned element to implement the marker. This way, both the marker and the character are implemented as independent elements, and the relationship between the border element and the character element is no longer parent-child but sibling at the same level. This allows the use of html-to-image filters (such as the filter API) to determine if an element is a marker. If it is, it is deleted; otherwise, it is retained. This allows the marker to be removed from the target page while the character is preserved.
[0099] In another example, the Document Object Model (DOM) node corresponding to the target page, `domNode`, can be copied to obtain the initial node `clonedNode`. Then, the markup elements are removed from the initial `clonedNode` to obtain the target node. Based on the target node, a vector graphic is generated. The vector graphic includes images and characters, with the images and characters matching the content of the images and characters on the target page. The vector graphic elements are then drawn on the canvas to obtain the processed page.
[0100] For example, you can first call the `toCanvas` method to get a Canvas object, then call the `nodeToDataURL` method of the canvas to convert the Document Object Model node (DOMNode) into a base64 string representing an image. Next, call the `getImageSize` method to get the image size, which can include width and height. Then call the `toSvg` method to get an SVG image, which can be used as the vector graphic. This SVG image is a file in memory. Next, call `createImage` to create the SVG image from memory as an image element. Then, you can create a canvas object to obtain the canvas and draw the vector graphic elements on it.
[0101] It's worth noting that after calling the `toSvg` method, this method can call the `cloneNode` method to copy the Document Object Model (DOM) node, then embed web fonts and images, and apply styles to obtain a vector graphic. Additionally, a preprocessing method can be configured in the `options` parameter. The `preprocess` method modifies the style of the `clonedNode` before adding it to the canvas, increasing the flexibility of modification. Furthermore, `clonedNode` is changed from `const` to `let` beforehand for assignment. In the `index.ts` file of `html-to-image`, a conditional process is added to the `toSvg` method, such as checking if the `preprocess` method is configured. If configured, the `preprocess` method is called. The input parameter of the `preprocess` method is the initial node `clonedNode`. Taking the marker symbol as an example, during the execution of the `preprocess` method, the child elements with border styles are identified from the initial node `clonedNode`, the border class of the child elements is removed, and then the initial node `clonedNode` is updated. The updated initial node `clonedNode` is the target node, thus removing the marker symbol from the target node to obtain a vector image without borders. This approach can minimize the impact on existing functions, avoid affecting existing users, and reduce online risks.
[0102] In some embodiments, during the process of drawing vector graphic elements on the canvas, a scaling ratio can be determined based on the size of the vector graphic and the target size. Then, the vector graphic is scaled based on the scaling ratio to obtain a scaled vector graphic. Next, the initial canvas size is set according to the target size to obtain the canvas. Finally, the scaled vector graphic is drawn on the canvas to obtain the processed page.
[0103] For example, a target size can be pre-configured, set as the initial canvas size, and this sized initial canvas can then be used as the final canvas. The ratio of the target size to the original size of the vector graphic can be used as a scaling factor, allowing the vector graphic to be scaled to match the canvas size. Furthermore, it's possible to determine if a background color exists; if so, it can be drawn onto the canvas. Finally, the scaled vector graphic is drawn onto the canvas, resulting in the processed page.
[0104] Figure 6 is a schematic flowchart of triggering video generation operation according to an embodiment of the present disclosure.
[0105] As shown in Figure 6, users can trigger the video generation process in multiple ways.
[0106] In one triggering method 601, the user can input information through the input box of the intelligent assistant. The system then performs intent recognition on the user's input to determine if the user intends to generate a video. If not, the intelligent assistant processes the input according to its original processing logic. If the user intends to generate a video, a prompt card can pop up to indicate that the video generation process is about to begin. Then, based on the user's input, the system can determine if a theme exists. If it does, the user can be guided to the style selection page with the theme. If not, the theme content is empty, and the user is redirected to the style selection page.
[0107] In another triggering method, 602, some general options can be pre-configured. If a user clicks an option, it indicates that the user wants to generate a video. A welcome card can then be displayed, and after the user clicks on a specific area of the welcome card (such as the "Try It Now" area), they are redirected to the style selection page.
[0108] In another triggering method 603, some options with style information can be pre-configured. If the user clicks on the option, the user will be redirected to the style selection page, and the anchor point corresponding to the style selected by the user will be recorded.
[0109] Figure 7 is a schematic flowchart of the selection style according to an embodiment of the present disclosure.
[0110] As shown in Figure 7, when a user enters the style selection page, configuration information is first obtained. This information may include the page title, available style cards, and the style card's name, image example, and position. The style cards are swiped, and the system determines whether to swipe to the desired style card based on the user's actions. If so, the system swipes each style card according to its anchor point. If the user hasn't selected a style, the first style card is set as the default. Additionally, the system checks if a theme has been obtained. If so, the user is directed to the image upload page after clicking the "Create Now" button, and the theme is then uploaded. Otherwise, the user is directed to the image upload page after clicking the "Create Now" button.
[0111] Figure 8 is a schematic flowchart of uploading images according to an embodiment of the present disclosure.
[0112] As shown in Figure 8, when a user enters the image upload page, they can select at least one input image to upload. After selecting an input image, it is stored locally. The image can then be uploaded to the cloud, and its path is converted to a URL. Furthermore, the theme and style can be further adjusted on this page. Then, file information is generated. Next, a video generation task can be initiated to generate a video based on the theme, style, and input images. After obtaining the generated video, it can be stored; if the video uses JSON data format, JSON data can be stored.
[0113] Figure 9 is a schematic flowchart of video generation based on input information according to an embodiment of the present disclosure.
[0114] As shown in Figure 9, after uploading the input image, the user can click the "Generate Now" button, which initiates a video generation task. The system then checks if the task was created successfully. If it fails, the system displays the reason for the failure and ends the process. If successful, the user is redirected to a waiting page. Furthermore, the video generation client can notify the intermediate server of the generation progress, and the client can poll the intermediate server to check the progress. After polling, the system checks if the task is in a queue. If it is, the waiting page is updated to "Queued" and the task times out. If it times out, the current page is closed; otherwise, the polling process returns. If the task is not in a queue, the system further checks if it is generating. If it is, the waiting page is updated to "Generating," and the system checks for timeout again. If it is not generating, the system checks if the task is completed. If it is completed, the user is redirected to the playback page; otherwise, the polling process returns.
[0115] Figure 10 is a schematic flowchart of video playback according to an embodiment of the present disclosure.
[0116] As shown in Figure 10, after the video is generated (which can be either the initial video mentioned above or the target video), the user can be redirected to the playback page. The page then determines whether the generated video is a portrait video. If it is, it is played in portrait mode; otherwise, it is played in landscape mode. Next, the page checks if the user has clicked "Full Screen View." If not, it continues in windowed mode; if the user has clicked "Full Screen View," it plays in landscape mode. If the user clicks "Back" in landscape mode, it switches to windowed mode.
[0117] In addition, when playing a video in any of the portrait, window, or landscape modes, the video and audio can be set separately, allowing for independent control of the image and audio. For example, the audio can be played while the image is playing.
[0118] Figure 11 is a schematic structural block diagram of a video generation apparatus according to an embodiment of the present disclosure.
[0119] As shown in Figure 11, the device 1100 for generating video may include a conversion module 1110, a story determination module 1120, an initial video determination module 1130, and an update module 1140.
[0120] The conversion module 1110 is used to convert N input images in the input information into N images that conform to the target style in the input information in response to receiving input information; N is an integer greater than or equal to 1.
[0121] The story determination module 1120 is used to determine the story text based on N input images; wherein the story text includes N sub-texts corresponding to the N images.
[0122] The initial video determination module 1130 is used to determine an initial video based on N images and N subtexts. The initial video comprises multiple pages, each page including an image and subtext.
[0123] The update module 1140 is used to respond to a determination of a modification operation for characters in a target page among multiple pages, and to update the initial video according to the character attributes of the modified characters or the page image of the modified target page to obtain the target video; wherein, the characters include subtext in the target page.
[0124] According to another embodiment of this disclosure, character attributes are determined by the following modules: a first coordinate determination module, a second coordinate determination module, and a third coordinate determination module. The first coordinate determination module is used to determine the coordinates of each character on the target page. The second coordinate determination module is used to determine the coordinates of at least one line of characters on the target page based on the coordinates of each character. The third coordinate determination module is used to determine the coordinates of at least one line of characters on the back end based on the target adjustment ratio, the size of the target page on the front end, and the coordinates of at least one line of characters on the target page. The character attributes include the coordinates of at least one line of characters on the back end.
[0125] According to another embodiment of this disclosure, the modified target page includes: an image, characters, and markers indicating the area where the characters are located. The page image of the modified target page is obtained through the following modules: a deletion module, a screenshot module, and an image determination module. The deletion module is used to delete the markers from the target page to obtain the processed page. The screenshot module is used to perform a screenshot operation on the processed page. The image determination module is used to determine the page image of the modified target page based on the image obtained from the screenshot operation.
[0126] According to another embodiment of this disclosure, the deletion module includes a setting submodule and a first deletion submodule. The setting submodule is used to set both characters and markers in the target page as elements in the target page, and to make the elements of the characters and the elements of the markers sibling elements. The first deletion submodule is used to delete the elements of the markers from the target page, resulting in a processed page.
[0127] According to another embodiment of this disclosure, the deletion module includes: a copy submodule, a second deletion submodule, a vector graphic generation submodule, and a drawing submodule. The copy submodule is used to copy the document object model node corresponding to the target page to obtain an initial node. The second deletion submodule is used to delete the marker element from the initial node to obtain the target node. The vector graphic generation submodule is used to generate a vector graphic based on the target node. The vector graphic includes images and characters, where the images in the vector graphic are identical to the images in the target page, and the characters in the vector graphic are identical to the characters in the target page. The drawing submodule is used to draw vector graphic elements on a canvas to obtain the processed page.
[0128] According to another embodiment of this disclosure, the drawing submodule includes: a scale determination unit, a scaling unit, a setting unit, and a drawing unit. The scale determination unit determines a scaling ratio based on the dimensions of the vector graphic and the target dimensions. The scaling unit scales the vector graphic based on the scaling ratio to obtain a scaled vector graphic. The setting unit sets the initial canvas dimensions according to the target dimensions to obtain a canvas. The drawing unit draws the scaled vector graphic on the canvas to obtain a processed page.
[0129] According to another embodiment of this disclosure, the modification operation includes at least one of the following: modifying the content of characters on the target page, or moving the position of characters on the target page.
[0130] According to another embodiment of this disclosure, the conversion module includes a first image understanding submodule and a conversion submodule. The first image understanding submodule is used to perform image understanding on each of N input images to obtain labels for at least one object included in the input image. Each of the at least one object corresponds to at least one label, and the label includes text describing the features possessed by the object. The conversion submodule is used to convert the input image into an image conforming to a target style based on the at least one label corresponding to each object.
[0131] According to another embodiment of this disclosure, the story determination module includes: a second image understanding submodule, a copywriting style determination submodule, and an expansion submodule. The second image understanding submodule performs image understanding on N input images to obtain N descriptive texts for the N input images, whereby the N descriptive texts describe the image content of the N input images. The copywriting style determination submodule determines a target copywriting style from multiple candidate copywriting styles based on the N descriptive texts. The expansion submodule utilizes a large language model to expand the story text based on the N descriptive texts and the target copywriting style.
[0132] According to another embodiment of this disclosure, the input information further includes a topic. The copywriting style determination submodule includes a determination unit and an input unit. The determination unit is used to determine the input text based on the topic, N descriptive texts, and a prompt message template. The input unit is used to input the input text into a large language model to obtain the target copywriting style. The prompt message template includes multiple candidate copywriting styles, and the prompt message template represents that the large language model selects the target copywriting style from multiple candidate copywriting styles based on the topic and N descriptive texts.
[0133] According to embodiments of this disclosure, this disclosure also provides an electronic device, including at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described method for generating video.
[0134] According to embodiments of this disclosure, this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the above-described method for generating video.
[0135] According to embodiments of this disclosure, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for generating video.
[0136] Figure 12 is a structural block diagram of an electronic device used to implement the method for generating video according to embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0137] As shown in Figure 12, device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1202 or a computer program loaded from storage unit 1208 into random access memory (RAM) 1203. The RAM 1203 may also store various programs and data required for the operation of device 1200. The computing unit 1201, ROM 1202, and RAM 1203 are interconnected via bus 1204. Input / output (I / O) interface 1205 is also connected to bus 1204.
[0138] Multiple components in device 1200 are connected to I / O interface 1205, including: input unit 1206, such as keyboard, mouse, etc.; output unit 1207, such as various types of monitors, speakers, etc.; storage unit 1208, such as disk, optical disk, etc.; and communication unit 1209, such as network card, modem, wireless transceiver, etc. Communication unit 1209 allows device 1200 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0139] The computing unit 1201 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1201 performs the various methods and processes described above, such as the method of generating video. For example, in some embodiments, the method of generating video may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1200 via ROM 1202 and / or communication unit 1209. When the computer program is loaded into RAM 1203 and executed by the computing unit 1201, one or more steps of the method of generating video described above may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured to perform the method of generating video by any other suitable means (e.g., by means of firmware).
[0140] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0141] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0142] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0143] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0144] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0145] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0146] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0147] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for generating video, comprising: In response to receiving input information, N input images in the input information are converted into N images conforming to the target style in the input information; wherein N is an integer greater than or equal to 1, the input images include at least one object, each of the at least one object corresponds to at least one label, the label includes text for describing the characteristics of the object; the conversion of the N input images in the input information into N images conforming to the target style in the input information includes: for each of the N input images, determining the number of objects in the input image, determining a scene based on the number of objects, and if the scene is a multi-object scene, establishing a correspondence between the label and the object location, and generating an image region for the object location based on the label; determining story text based on the N input images; wherein the story text includes N sub-texts corresponding to the N images; determining an initial video based on the N images and the N sub-texts; wherein the initial video includes multiple pages, each page including an image and sub-text; and in response to determining the multiple The modification operation of characters in the target page involves updating the initial video based on the character attributes of the modified characters or the page image of the modified target page to obtain the target video; wherein, the characters include subtext in the target page; the modified target page includes: the image, the characters, and a marker symbol for indicating the area where the characters are located; wherein, the character attributes are determined by: determining the relative coordinates of at least one line of characters in the target page during the front-end display based on the size of the target page in the front end and the coordinates of at least one line of characters in the target page; enlarging or shrinking the size of the target page based on the target adjustment ratio; determining the coordinates of at least one line of characters in the back end based on the relative coordinates; the character attributes include the coordinates of at least one line of characters in the back end; wherein, the page image of the modified target page is obtained by: deleting the marker symbol from the target page to obtain the processed page; taking a screenshot of the processed page; and determining the page image of the modified target page based on the image obtained from the screenshot operation.
2. The method according to claim 1, wherein, The character attributes are determined by: for each character in the target page, determining the coordinates of the character in the target page; and based on the coordinates of each character, determining the coordinates of at least one row of characters in the target page.
3. The method according to claim 1, wherein, The step of deleting the marker symbol from the target page to obtain the processed page includes: setting both the character and the marker symbol in the target page as elements in the target page, and making the elements of the character and the elements of the marker symbol sibling elements; and deleting the elements of the marker symbol from the target page to obtain the processed page.
4. The method according to claim 1, wherein, The step of deleting the marker symbol from the target page to obtain the processed page includes: copying the document object model node corresponding to the target page to obtain an initial node; deleting the element of the marker symbol from the initial node to obtain a target node; generating a vector graphic based on the target node, the vector graphic including images and characters, wherein the images in the vector graphic are consistent with the image content in the target page, and the characters in the vector graphic are consistent with the characters in the target page; and drawing the vector graphic elements on a canvas to obtain the processed page.
5. The method according to claim 4, wherein, The step of drawing the vector graphic element on the canvas to obtain the processed page includes: determining a scaling ratio based on the size of the vector graphic and the target size; scaling the vector graphic based on the scaling ratio to obtain a scaled vector graphic; setting the initial canvas size according to the target size to obtain the canvas; and drawing the scaled vector graphic on the canvas to obtain the processed page.
6. The method according to claim 1, wherein, The modification operation includes at least one of the following: modifying the content of characters on the target page, or moving the position of characters on the target page.
7. The method according to claim 1, wherein, The step of converting the N input images in the input information into N images that conform to the target style in the input information further includes: for each of the N input images, performing image understanding on the input image to obtain a label for at least one object included in the input image.
8. The method according to claim 1, wherein, The step of determining the story text based on the N input images includes: performing image understanding on the N input images to obtain N descriptive texts for the N input images, wherein the N descriptive texts are used to describe the image content of the N input images; determining a target copywriting style from multiple candidate copywriting styles based on the N descriptive texts; and expanding the story text based on the N descriptive texts and the target copywriting style using a large language model.
9. The method according to claim 8, wherein, The input information also includes a topic; determining the target copy style from multiple candidate copy styles based on the N descriptive texts includes: determining input text according to the topic, the N descriptive texts, and the prompt information template; and inputting the input text into a large language model to obtain the target copy style; wherein, the prompt information template includes the multiple candidate copy styles, and the prompt information template represents that: the large language model selects the target copy style from the multiple candidate copy styles according to the topic and the N descriptive texts.
10. An apparatus for generating video, comprising: A conversion module is configured to, in response to receiving input information, convert N input images in the input information into N images conforming to a target style in the input information; wherein N is an integer greater than or equal to 1, the input images include at least one object, each of the at least one object corresponds to at least one label, the label including text describing the characteristics of the object; the conversion module includes a conversion submodule, configured to, for each of the N input images, determine the number of objects in the input image, determine a scene based on the number of objects, and, if the scene is a multi-object scene, establish a correspondence between the label and the object location, and generate an image region for the object location based on the label; a story determination module is configured to, based on the N input images, determine story text; wherein the story text includes N sub-texts corresponding to the N images; an initial video determination module is configured to, based on the N images and the N sub-texts, determine an initial video; wherein the initial video includes multiple pages, each page including an image and sub-text; and an update module is configured to, in response to determining a target page among the multiple pages... The modification operation of characters in the video updates the initial video based on the character attributes of the modified characters or the page image of the modified target page to obtain the target video; wherein, the characters include subtext in the target page; the modified target page includes: the image, the characters, and a marker symbol for indicating the area where the characters are located; wherein, the character attributes are determined by: determining the relative coordinates of at least one line of characters in the target page during the front-end display based on the size of the target page in the front end and the coordinates of at least one line of characters in the target page; enlarging or shrinking the size of the target page based on the target adjustment ratio; determining the coordinates of at least one line of characters in the back end based on the relative coordinates; the character attributes include the coordinates of at least one line of characters in the back end; wherein, the page image of the modified target page is obtained through the following modules: a deletion module for deleting the marker symbol from the target page to obtain the processed page; a screenshot module for taking a screenshot of the processed page; and an image determination module for determining the page image of the modified target page based on the image obtained from the screenshot operation.
11. The apparatus according to claim 10, wherein, The character attributes are determined by the following modules: a first coordinate determination module, used to determine the coordinates of each character on the target page; and a second coordinate determination module, used to determine the coordinates of at least one row of characters on the target page based on the coordinates of each character.
12. The apparatus according to claim 10, wherein, The deletion module includes: a setting submodule, configured to set both the character and the marker symbol in the target page as elements in the target page, and to make the elements of the character and the elements of the marker symbol sibling elements; and a first deletion submodule, configured to delete the element of the marker symbol from the target page to obtain the processed page.
13. The apparatus according to claim 10, wherein, The deletion module includes: a copy submodule, used to copy the document object model node corresponding to the target page to obtain an initial node; a second deletion submodule, used to delete the element of the marker symbol from the initial node to obtain a target node; a vector graphic generation submodule, used to generate a vector graphic based on the target node, the vector graphic including images and characters, the images in the vector graphic being consistent with the image content in the target page, and the characters in the vector graphic being consistent with the characters in the target page; and a drawing submodule, used to draw the vector graphic elements on a canvas to obtain the processed page.
14. The apparatus according to claim 13, wherein, The drawing submodule includes: a scale determination unit, used to determine a scaling ratio based on the size of the vector graphic and the target size; a scaling unit, used to scale the vector graphic based on the scaling ratio to obtain a scaled vector graphic; a setting unit, used to set the initial canvas size based on the target size to obtain the canvas; and a drawing unit, used to draw the scaled vector graphic on the canvas to obtain the processed page.
15. The apparatus according to claim 10, wherein, The modification operation includes at least one of the following: modifying the content of characters on the target page, or moving the position of characters on the target page.
16. The apparatus according to claim 10, wherein, The conversion module further includes: a first image understanding submodule, used to perform image understanding on each of the N input images to obtain a label for at least one object included in the input image.
17. The apparatus according to claim 10, wherein, The story determination module includes: a second image understanding submodule, used to perform image understanding on the N input images to obtain N descriptive texts for the N input images, the N descriptive texts being used to describe the image content of the N input images; a copywriting style determination submodule, used to determine a target copywriting style from multiple candidate copywriting styles based on the N descriptive texts; and an expansion submodule, used to expand the story text using a large language model based on the N descriptive texts and the target copywriting style.
18. The apparatus according to claim 17, wherein, The input information also includes a topic; the copywriting style determination submodule includes: a determination unit, used to determine the input text based on the topic, the N descriptive texts, and the prompt information template; and an input unit, used to input the input text into a large language model to obtain the target copywriting style; wherein, the prompt information template includes the multiple candidate copywriting styles, and the prompt information template represents that: the large language model selects the target copywriting style from the multiple candidate copywriting styles based on the topic and the N descriptive texts.
19. An electronic device comprising: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 9.
21. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Zoom-display processing method and device for page contents
CN104050185A
Page access method, apparatus and device, and storage medium
CN110457620A
Short video generation method and device
CN111866587A
Video generation method and device
CN117009581A