Video fusion method, device, electronic device and storage medium
By calling the graphics processor object in video fusion to create an off-screen canvas and dynamically redraw the video static texture, the problem of low video fusion efficiency in the existing technology is solved, and more efficient three-dimensional scene video rendering and processing is achieved.
Patent Information
- Application Number
- CN202410723837.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-05
AI Technical Summary
The video fusion efficiency in the existing technology is low, resulting in low overall efficiency of three-dimensional modeling in multi-lens and multi-angle video scenes, making it difficult to quickly and accurately identify specific locations in the video.
Create an off-screen canvas by calling the graphics processor object, draw the video static texture, and assign it to the 3D video box model for dynamic redrawing. Use babylon's DynamicTexture class to achieve video fusion, avoid thread blocking, and improve rendering and texture drawing efficiency.
It significantly improves the efficiency of video fusion and improves the rendering and processing speed of 3D scene videos. Compared with directly using the browser to process video frame information, it achieves a more efficient video fusion effect.
Smart Images

Figure CN118317143B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video processing technology, and in particular to a video fusion method, device, electronic equipment and storage medium. Background Art
[0002] In the application scenarios of video processing, it is often necessary to view images from multiple lenses and angles, for example, viewing surveillance videos in a scene, detecting targets through multi-angle videos, etc. Fusion of multi-lens and multi-angle videos and creation of 3D modeling of scenes can achieve faster and more accurate identification of specific locations in the video, but the efficiency of video fusion in related technologies is low, resulting in low overall efficiency in viewing 3D modeling of scenes. Summary of the invention
[0003] The purpose of the embodiments of the present invention is to provide a video fusion method, device, electronic device and storage medium to improve the efficiency of video fusion. The specific technical solution is as follows:
[0004] In a first aspect, an embodiment of the present invention provides a video fusion method, including:
[0005] In response to a user's operation of viewing a three-dimensional scene video of a target scene through a browser, acquiring multi-channel video frame information of the target scene;
[0006] Through the application programming interface, call the graphics processor object and create an off-screen canvas;
[0007] Using the graphics processor object to draw a video static texture of each channel of the video frame information in the off-screen canvas;
[0008] The multiple channels of video static textures are assigned to a pre-created three-dimensional video box model of the target scene, and the video static textures are dynamically redrawn in the three-dimensional video box model to obtain a three-dimensional scene video of the target scene.
[0009] In one embodiment of the present invention, calling a graphics processor object through an application programming interface and creating an off-screen canvas includes:
[0010] Using the application programming interface of the browser, calling the graphics processor object, and creating a first thread different from the browser thread;
[0011] The off-screen canvas is created using the first thread.
[0012] In one embodiment of the present invention, the step of drawing the video static texture of each channel of the video frame information in the off-screen canvas by using the graphics processor object includes:
[0013] Rendering the video frame information using the graphics processor object to obtain a rendering result;
[0014] The rendering result is drawn in the off-screen canvas to create the video static texture.
[0015] In one embodiment of the present invention, assigning the multiple channels of video static textures to a pre-created three-dimensional video box model of the target scene, and dynamically redrawing the video static textures in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene includes:
[0016] Obtaining location information of each channel of video frame information;
[0017] According to the position information, updating the basic texture at the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas;
[0018] The DynamicTexture class of Babylon is used to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene.
[0019] In one embodiment of the present invention, the method further comprises:
[0020] Creating a three-dimensional model of the target scene and obtaining sample video frame information of the target scene;
[0021] Using a shader editor, according to the position information of the sample video frame information, the sample video frame information is added as a material to a corresponding position of the three-dimensional model to obtain a basic texture of the three-dimensional model;
[0022] For each pixel point of the sample video frame information, a UV editor is used to adjust the two-dimensional texture mapping coordinates of the pixel point in the three-dimensional model until the position of each pixel point in the three-dimensional model meets the preset position parameters of the three-dimensional model, thereby obtaining a three-dimensional video box model of the target scene.
[0023] In one embodiment of the present invention, in response to a user viewing a three-dimensional scene video of a target scene through a browser, obtaining multi-channel video frame information of the target scene includes:
[0024] In response to a user's operation of viewing the three-dimensional scene video of the target scene through a browser, sending a start-stream command to a server, wherein the start-stream command includes identifiers of multiple collectors for collecting videos of the target scene;
[0025] Receiving open stream information returned by the server, wherein the open stream information includes multiple video stream data collected by each collector;
[0026] Decode the video stream data of each channel to obtain multi-channel video frame information of the target scene.
[0027] In a second aspect, an embodiment of the present invention provides a video fusion device, including:
[0028] A video frame acquisition module, used for acquiring multi-channel video frame information of a target scene in response to a user's operation of viewing a three-dimensional scene video of the target scene through a browser;
[0029] An off-screen canvas creation module, used to call a graphics processor object through an application programming interface and create an off-screen canvas;
[0030] A static texture drawing module, used for drawing a video static texture of each channel of the video frame information in the off-screen canvas by using the graphics processor object;
[0031] The 3D scene video acquisition module is used to assign multiple channels of video static textures to the pre-created 3D video box model of the target scene, and dynamically redraw the video static textures in the 3D video box model to obtain the 3D scene video of the target scene.
[0032] In one embodiment of the present invention, the off-screen canvas creation module is specifically used to:
[0033] Using the application programming interface of the browser, calling the graphics processor object, and creating a first thread different from the browser thread;
[0034] The off-screen canvas is created using the first thread.
[0035] In one embodiment of the present invention, the static texture rendering module is specifically used for:
[0036] Rendering the video frame information using the graphics processor object to obtain a rendering result;
[0037] The rendering result is drawn in the off-screen canvas to create the video static texture.
[0038] In one embodiment of the present invention, the three-dimensional scene video acquisition module is specifically used to:
[0039] Obtaining location information of each channel of video frame information;
[0040] According to the position information, updating the basic texture at the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas;
[0041] The DynamicTexture class of Babylon is used to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene.
[0042] In one embodiment of the present invention, the device further comprises:
[0043] A model creation module, used to create a three-dimensional model of the target scene and obtain sample video frame information of the target scene;
[0044] A basic texture adding module, used to use a shader editor to add the sample video frame information as a material to a corresponding position of the three-dimensional model according to the position information of the sample video frame information, so as to obtain a basic texture of the three-dimensional model;
[0045] The three-dimensional video box model acquisition module is used to adjust the two-dimensional texture mapping coordinates of each pixel point of the sample video frame information in the three-dimensional model using a UV editor until the position of each pixel point in the three-dimensional model meets the preset position parameters of the three-dimensional model, thereby obtaining the three-dimensional video box model of the target scene.
[0046] In one embodiment of the present invention, the video frame acquisition module is specifically used to:
[0047] In response to a user's operation of viewing the three-dimensional scene video of the target scene through a browser, sending a start-stream command to a server, wherein the start-stream command includes identifiers of multiple collectors for collecting videos of the target scene;
[0048] Receiving open stream information returned by the server, wherein the open stream information includes multiple video stream data collected by each collector;
[0049] Decode the video stream data of each channel to obtain multi-channel video frame information of the target scene.
[0050] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0051] Memory, used to store computer programs;
[0052] The processor is used to implement any of the above-mentioned method steps when executing the program stored in the memory.
[0053] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described above is implemented.
[0054] The embodiment of the present invention further provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any of the above-mentioned video fusion methods.
[0055] Beneficial effects of the embodiments of the present invention:
[0056] The video fusion method provided by the embodiment of the present invention obtains multi-channel video frame information of the target scene in response to the user's operation of watching the three-dimensional scene video of the target scene through the browser; calls the graphics processor object through the application programming interface and creates an off-screen canvas; uses the graphics processor object to draw the video static texture of each channel of video frame information in the off-screen canvas, and establishes a new thread dedicated to rendering video and drawing static textures, thereby avoiding thread blocking caused by numerous thread tasks and speeding up the efficiency of video rendering and texture drawing; calls the GPU resources in the hardware resources to realize video rendering and texture drawing, further improving the efficiency of video processing. The multi-channel video static textures are assigned to the pre-created three-dimensional video box model of the target scene, and the video static textures are dynamically redrawn in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene. Compared with directly using the browser to process the video frame information in the form of web tags, the efficiency of video fusion is effectively improved.
[0057] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0059] Figure 1 A schematic diagram of the process of the first video fusion method provided in the embodiment of the present application;
[0060] Figure 2 A possible implementation method of step S102 provided in an embodiment of the present application;
[0061] Figure 3 A possible implementation method of step S103 provided in an embodiment of the present application;
[0062] Figure 4A possible implementation method of step S104 provided in an embodiment of the present application;
[0063] Figure 5 A schematic diagram of a second video fusion method provided in an embodiment of the present application;
[0064] Figure 6 A possible implementation method of step S101 provided in an embodiment of the present application;
[0065] Figure 7 A flowchart of a video fusion method provided in an embodiment of the present application;
[0066] Figure 8 A schematic diagram of the structure of a video fusion device provided in an embodiment of the present application;
[0067] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0068] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field based on this application belong to the scope of protection of the present invention.
[0069] Since the video fusion efficiency in the related art is low, in order to solve the above problem, the present invention provides a video fusion method, device, electronic device and storage medium. The video fusion method can be executed by an electronic device. Specifically, the electronic device can be a personal terminal, a mobile phone, a computer, a service center, etc.
[0070] First, see Figure 1 , the embodiment of the present invention provides a flowchart of a first video fusion method, including:
[0071] Step S101 , in response to a user's operation of viewing a three-dimensional scene video of a target scene through a browser, multi-channel video frame information of the target scene is acquired.
[0072] The target scene refers to the scene that the user can collect images / videos and view through the camera / collector. Specifically, it can be a monitoring scene of a surveillance video, a detection scene in the target detection process, etc. For example, a room, a traffic intersection, a forest farm, etc. The three-dimensional scene video of the target scene refers to a three-dimensional video that can reflect the real-time status of the target scene.
[0073] In one example, the operation of a user viewing a 3D scene video of a target scene through a browser may be to open an application capable of displaying the 3D scene video through the browser to load the 3D scene video of the target scene. For example, the 3D scene video of the target scene may be loaded through the browser with babylon.js (a JavaScript framework, JavaScript refers to a programming language of just-in-time compilation), so as to realize viewing of the 3D scene video.
[0074] In response to the user's operation, multi-channel video frame information of the target scene is obtained. Specifically, the multi-channel video frame information refers to real-time video data of the multi-directional target scene collected by multi-angle, multi-lens cameras / collectors.
[0075] Step S102: calling a graphics processor object through an application programming interface and creating an off-screen canvas.
[0076] In one example, a browser usually uses pre-allocated hardware resources to run the browser itself. In related technologies, videos are often directly placed in 3D modeling based on the form of Web (World Wide Web) tags using the hardware resources allocated to the browser itself. This can easily lead to browser overload, slow loading speed, and low efficiency.
[0077] In the embodiment of the present invention, through the application programming interface, in addition to the resources allocated by the browser itself, the graphics processor object is called from the hardware resources to create an off-screen canvas to prepare for subsequent video rendering.
[0078] In one embodiment of the present invention, Figure 2 As shown, the above step S102 calls the graphics processor object through the application programming interface and creates an off-screen canvas, including:
[0079] Step S201, using the browser's application programming interface (WebGPU API) to call the graphics processor object (GPU device) to create a first thread different from the browser thread;
[0080] Step S202: Create the off-screen canvas using the first thread.
[0081] The browser thread refers to the main thread currently in progress, and the first thread refers to the auxiliary thread used to render video frames. The first thread is used to create an off-screen canvas, and the canvas element is used as the canvas of the WebGPU (network graphics processor).
[0082] Compared with rendering the video directly in the main thread, the creation of the auxiliary thread can avoid blocking the main thread and further improve the drawing efficiency.
[0083] Step S103: draw the video static texture of each channel of the video frame information in the off-screen canvas using the graphics processor object.
[0084] The video static texture of each channel of video frame information is drawn in the off-screen canvas using the graphics processor object, and the real-time video data of the multi-directional target scene is drawn into images frame by frame in the off-screen canvas to obtain the video static texture of each channel of video frame information.
[0085] In one embodiment of the present invention, Figure 3 As shown, the above step S103 uses the graphics processor object to draw the video static texture of each channel of the video frame information in the off-screen canvas, including:
[0086] Step S301, using the graphics processor object to render the video frame information to obtain a rendering result;
[0087] Step S302: Draw the rendering result in the off-screen canvas to create the video static texture.
[0088] The video frames are rendered using a graphics processor object (GPU device), and the rendered results are drawn in an off-screen canvas to create a video static texture corresponding to multiple video frame information.
[0089] Compared with directly using the WebGPU canvas for drawing, using the off-screen canvas for drawing in the auxiliary thread makes drawing more flexible and avoids rendering and drawing jams caused by blocking the main thread.
[0090] Step S104, assigning the multiple channels of video static textures to the pre-created three-dimensional video box model of the target scene, and dynamically redrawing the video static textures in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene.
[0091] The three-dimensional video box model of the target scene is a three-dimensional modeling of the target scene created in advance. The multi-channel video static texture is assigned to the three-dimensional video box model, which means that the off-screen canvas on which the above-mentioned video static texture has been drawn is assigned to the three-dimensional video box model, so as to realize the display of the above-mentioned acquired multi-channel video frame information in the three-dimensional video box model.
[0092] The video static texture is dynamically redrawn in the three-dimensional video box model to make the multi-channel video static texture dynamic, so as to dynamically display the target scene video corresponding to the multi-channel video frame information in the three-dimensional video box model and obtain the three-dimensional scene video of the target scene.
[0093] As can be seen from the above, the video fusion method provided by the embodiment of the present invention obtains multi-channel video frame information of the target scene in response to the user's operation of watching the three-dimensional scene video of the target scene through the browser; calls the graphics processor object through the application programming interface and creates an off-screen canvas; uses the graphics processor object to draw the video static texture of each channel of video frame information in the off-screen canvas, and establishes a new thread dedicated to rendering video and drawing static textures, thereby avoiding thread blocking caused by numerous thread tasks and speeding up the efficiency of video rendering and texture drawing; calls the GPU resources in the hardware resources to realize video rendering and texture drawing, further improving the efficiency of video processing. Multi-channel video static textures are assigned to the pre-created three-dimensional video box model of the target scene, and the video static textures are dynamically redrawn in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene. Compared with directly using the browser to process video frame information in the form of web tags, the efficiency of video fusion is effectively improved.
[0094] In one embodiment of the present invention, Figure 4 As shown, the above step S104 assigns the multiple channels of video static textures to the pre-created three-dimensional video box model of the target scene, and dynamically redraws the video static textures in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene, including:
[0095] Step S401, obtaining the position information of each channel of the video frame information;
[0096] Step S402, updating the basic texture at the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas according to the position information;
[0097] Step S403, using the DynamicTexture class (dynamic texture function) of babylon (babylon.js, an open source 3D game engine), dynamically fusion and redraw the video static texture in the 3D video box model to obtain the 3D scene video of the target scene.
[0098] The position information of the video frame information refers to the position in the target scene corresponding to each channel of the video frame information. For example, when the target scene is a room, each channel of the video frame information corresponds to each position in the room. In one example, each channel of the video frame information may carry the identifier of the collector that collected the video, and each collector corresponds to a different position in the target scene. The positions corresponding to each channel of the video frame information may have some overlapping areas.
[0099] Load the 3D video box model (exemplarily, it can be loaded based on babylon.js), assign the off-screen canvas with the video static texture drawn to the 3D video box model according to the position information of each video frame information, and use the video static texture of each channel to update the basic texture of the corresponding position in the 3D video box model. For example, when the target scene is a traffic intersection, the position information of one video frame information is the intersection in the northwest direction, and the video static texture corresponding to the video frame information is used to update the basic texture of the intersection in the northwest direction. The basic texture refers to the texture pre-set when the 3D video box model is created.
[0100] By using the DynamicTexture class of babylon, the static textures of each video are dynamically fused and redrawn (redrawn on canvas) in the 3D video box model, so that the static textures of each video are dynamic and the 3D scene video of the target scene is obtained. The 3D scene video represents the 3D video played in real time on the 3D modeling of the target scene.
[0101] As can be seen from the above, the video fusion method provided by the embodiment of the present invention obtains the position information of each channel of video frame information, updates the basic texture of the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas according to the position information, and uses the DynamicTexture class of babylon to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene, assign the video static texture to the corresponding position in the three-dimensional video box model, and use babylon to create a dynamic texture, thereby improving the accuracy of video fusion.
[0102] In one embodiment of the present invention, Figure 5 As shown, the method also includes:
[0103] Step S501, creating a three-dimensional model of a target scene, and obtaining sample video frame information of the target scene;
[0104] Step S502, using a shader editor, according to the position information of the sample video frame information, adding the sample video frame information as a material to a corresponding position of the three-dimensional model to obtain a basic texture of the three-dimensional model;
[0105] Step S503, for each pixel point of the sample video frame information, use a UV editor (a two-dimensional texture mapping coordinate editing tool) to adjust the two-dimensional texture mapping coordinates of the pixel point in the three-dimensional model until the position of each pixel point in the three-dimensional model meets the preset position parameters of the three-dimensional model, thereby obtaining a three-dimensional video box model of the target scene.
[0106] The sample video frame information of the target scene represents the historical video of the target scene, and may also refer to the video currently collected in real time when creating the 3D model. In an example, creating the 3D model of the target scene may be implemented using a 3D application, such as 3dsmax, blender (two examples of 3D modeling applications), and the like.
[0107] According to the position information of the sample video frame information, the sample video frame information is added as a material to the corresponding position in the 3D model of the target scene using the shader editor to obtain the basic texture of the 3D model. For each pixel point of the sample video frame information added to the 3D modeling, the 2D texture mapping coordinates (UV coordinates) of the pixel point are adjusted using the UV editor so that the UV coordinates of each pixel point meet the preset position parameters of the 3D model.
[0108] Specifically, the preset position parameter is a pre-set parameter, which means that when the pixel point meets the parameter, the obtained basic texture can restore the actual situation of the target scene to the greatest extent. Exemplarily, the preset position parameter may include specific coordinate information that each pixel point should meet.
[0109] In one example, a 3D video box model of a target scene can be loaded via babylon.js.
[0110] From the above, it can be seen that the video fusion method provided by an embodiment of the present invention uses the sample video frame information of the target scene as the basic texture for three-dimensional modeling of the target scene, and uses a UV editor to adjust the two-dimensional texture mapping coordinates of the pixel points so that the obtained three-dimensional video box model can restore the target scene as much as possible, thereby improving the accuracy of video fusion.
[0111] In one embodiment of the present invention, Figure 6 As shown, the above step S101 obtains multi-channel video frame information of the target scene in response to the user's operation of viewing the 3D scene video of the target scene through the browser, including:
[0112] Step S601: in response to a user's operation of viewing a 3D scene video of a target scene through a browser, a start stream command is sent to a server.
[0113] The open stream command includes the identifiers of multiple collectors for collecting videos of the target scene, and the identifiers may be ids (identity identifiers), numbers, etc.;
[0114] Step S602: receiving the open flow information returned by the server.
[0115] Wherein, the open stream information includes multiple video stream data collected by each collector;
[0116] Step S603: decode the video stream data of each channel to obtain multi-channel video frame information of the target scene.
[0117] In response to the user's operation of watching the 3D scene video of the target scene through the browser, a stream opening command is sent to the server through http (Hypertext Transfer Protocol), the corresponding stream opening information is obtained, a websocket connection (a protocol for full-duplex communication on a single TCP connection, a two-way communication connection, TCP refers to the Transmission Control Protocol) is established through the obtained stream opening information, and the real-time video stream data of the target scene collected by each collector is returned. Decode each video stream data to obtain the multi-channel video frame information of the target scene.
[0118] As can be seen from the above, the video fusion method provided in the embodiment of the present invention accurately obtains the required video stream data of each channel by sending an open stream command, and decodes to obtain multi-channel video frame information, thereby improving the efficiency of video processing.
[0119] like Figure 7 As shown, a flow chart of a video fusion method is provided. Create a 3D model of the target scene, add materials to the 3D model and edit the UV coordinates, and create a 3D video box model of the target scene. Call the graphics processor object, create an off-screen canvas, obtain the video frame information of each channel, and draw the video static texture in the off-screen canvas. Load the 3D video box model, add the video static texture to the model, and dynamically redraw it through Babylon to create a video dynamic texture, update the video texture in the 3D video box model, and obtain the 3D scene video of the target scene.
[0120] Second, see Figure 8 , an embodiment of the present invention provides a structural schematic diagram of a video fusion device, including:
[0121] The video frame acquisition module 801 is used to acquire multi-channel video frame information of the target scene in response to the user's operation of viewing the 3D scene video of the target scene through the browser;
[0122] The off-screen canvas creation module 802 is used to call the graphics processor object through the application programming interface and create an off-screen canvas;
[0123] A static texture drawing module 803, used for drawing the video static texture of each channel of the video frame information in the off-screen canvas by using the graphics processor object;
[0124] The 3D scene video acquisition module 804 is used to assign multiple channels of video static textures to the pre-created 3D video box model of the target scene, and dynamically redraw the video static textures in the 3D video box model to obtain the 3D scene video of the target scene.
[0125] As can be seen from the above, the video fusion device provided by the embodiment of the present invention obtains multi-channel video frame information of the target scene in response to the user's operation of watching the three-dimensional scene video of the target scene through the browser; calls the graphics processor object through the application programming interface and creates an off-screen canvas; uses the graphics processor object to draw the video static texture of each channel of video frame information in the off-screen canvas, and establishes a new thread dedicated to rendering video and drawing static textures, thereby avoiding thread blocking caused by numerous thread tasks and speeding up the efficiency of video rendering and texture drawing; calls the GPU resources in the hardware resources to realize video rendering and texture drawing, further improving the efficiency of video processing. Multi-channel video static textures are assigned to the pre-created three-dimensional video box model of the target scene, and the video static textures are dynamically redrawn in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene. Compared with directly using the browser to process video frame information in the form of web tags, the efficiency of video fusion is effectively improved.
[0126] In one embodiment of the present invention, the off-screen canvas creation module 802 is specifically used to:
[0127] Using the application programming interface of the browser, calling the graphics processor object, and creating a first thread different from the browser thread;
[0128] The off-screen canvas is created using the first thread.
[0129] In one embodiment of the present invention, the static texture rendering module 803 is specifically used for:
[0130] Rendering the video frame information using the graphics processor object to obtain a rendering result;
[0131] The rendering result is drawn in the off-screen canvas to create the video static texture.
[0132] In one embodiment of the present invention, the 3D scene video obtaining module 804 is specifically used for:
[0133] Obtaining location information of each channel of video frame information;
[0134] According to the position information, updating the basic texture at the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas;
[0135] The DynamicTexture class of Babylon is used to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene.
[0136] As can be seen from the above, the video fusion device provided by the embodiment of the present invention obtains the position information of each channel of video frame information, and updates the basic texture of the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas according to the position information, and uses the DynamicTexture class of babylon to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene, assign the video static texture to the corresponding position in the three-dimensional video box model, and use babylon to create a dynamic texture, thereby improving the accuracy of video fusion.
[0137] In one embodiment of the present invention, the device further comprises:
[0138] A model creation module, used to create a three-dimensional model of the target scene and obtain sample video frame information of the target scene;
[0139] A basic texture adding module, used to use a shader editor to add the sample video frame information as a material to a corresponding position of the three-dimensional model according to the position information of the sample video frame information, so as to obtain a basic texture of the three-dimensional model;
[0140] The three-dimensional video box model acquisition module is used to adjust the two-dimensional texture mapping coordinates of each pixel point of the sample video frame information in the three-dimensional model using a UV editor until the position of each pixel point in the three-dimensional model meets the preset position parameters of the three-dimensional model, thereby obtaining the three-dimensional video box model of the target scene.
[0141] From the above, it can be seen that the video fusion device provided by an embodiment of the present invention uses the sample video frame information of the target scene as the basic texture for three-dimensional modeling of the target scene, and uses a UV editor to adjust the two-dimensional texture mapping coordinates of the pixel points so that the obtained three-dimensional video box model can restore the target scene as much as possible, thereby improving the accuracy of video fusion.
[0142] In one embodiment of the present invention, the video frame acquisition module 801 is specifically used for:
[0143] In response to a user's operation of viewing the three-dimensional scene video of the target scene through a browser, sending a start-stream command to a server, wherein the start-stream command includes identifiers of multiple collectors for collecting videos of the target scene;
[0144] Receiving open stream information returned by the server, wherein the open stream information includes multiple video stream data collected by each collector;
[0145] Decode the video stream data of each channel to obtain multi-channel video frame information of the target scene.
[0146] As can be seen from the above, the video fusion device provided in the embodiment of the present invention accurately obtains the required video stream data of each channel by sending an open stream command, and decodes to obtain multi-channel video frame information, thereby improving the efficiency of video processing.
[0147] The embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, it includes a processor 901 , a communication interface 902 , a memory 903 and a communication bus 904 , wherein the processor 901 , the communication interface 902 , and the memory 903 communicate with each other via the communication bus 904 .
[0148] Memory 903, used for storing computer programs;
[0149] The processor 901 is used to implement any of the above-mentioned video fusion method steps when executing the program stored in the memory 903.
[0150] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0151] The communication interface is used for communication between the above electronic device and other devices.
[0152] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0153] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0154] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned video fusion methods are implemented.
[0155] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes any one of the video fusion methods in the above embodiments.
[0156] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), a solid-state hard disk (SSD), etc.
[0157] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0158] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0159] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A video fusion method, characterized in that: include: In response to a user's operation of viewing a three-dimensional scene video of a target scene through a browser, acquiring multi-channel video frame information of the target scene; Using the application programming interface of the browser, calling a graphics processor object to create a first thread different from the browser thread; Creating an off-screen canvas using the first thread; Rendering the video frame information using the graphics processor object to obtain a rendering result; Drawing the rendering result in the off-screen canvas to create a video static texture; The multiple channels of video static textures are assigned to a pre-created three-dimensional video box model of the target scene, and the video static textures are dynamically redrawn in the three-dimensional video box model to obtain a three-dimensional scene video of the target scene.
2. The method according to claim 1, characterized in that The step of assigning the multiple channels of video static textures to a pre-created three-dimensional video box model of the target scene, and dynamically redrawing the video static textures in the three-dimensional video box model to obtain a three-dimensional scene video of the target scene includes: Obtaining location information of each channel of video frame information; According to the position information, updating the basic texture at the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas; The DynamicTexture class of Babylon is used to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene.
3. The method according to claim 1, characterized in that The method further comprises: Creating a three-dimensional model of the target scene and obtaining sample video frame information of the target scene; Using a shader editor, according to the position information of the sample video frame information, the sample video frame information is added as a material to a corresponding position of the three-dimensional model to obtain a basic texture of the three-dimensional model; For each pixel point of the sample video frame information, a UV editor is used to adjust the two-dimensional texture mapping coordinates of the pixel point in the three-dimensional model until the position of each pixel point in the three-dimensional model meets the preset position parameters of the three-dimensional model, thereby obtaining a three-dimensional video box model of the target scene.
4. The method according to claim 1, characterized in that: The step of obtaining multi-channel video frame information of the target scene in response to the user viewing the three-dimensional scene video of the target scene through the browser includes: In response to a user's operation of viewing the three-dimensional scene video of the target scene through a browser, sending a start-stream command to a server, wherein the start-stream command includes identifiers of multiple collectors for collecting videos of the target scene; Receiving open stream information returned by the server, wherein the open stream information includes multiple video stream data collected by each collector; Decode the video stream data of each channel to obtain multi-channel video frame information of the target scene.
5. A video fusion device, characterized in that: include: A video frame acquisition module, used for acquiring multi-channel video frame information of a target scene in response to a user's operation of viewing a three-dimensional scene video of the target scene through a browser; An off-screen canvas creation module, configured to use the application programming interface of the browser to call a graphics processor object to create a first thread different from the browser thread; and use the first thread to create the off-screen canvas; A static texture rendering module, used for rendering the video frame information using the graphics processor object to obtain a rendering result; Drawing the rendering result in the off-screen canvas to create a video static texture; The 3D scene video acquisition module is used to assign multiple channels of video static textures to the pre-created 3D video box model of the target scene, and dynamically redraw the video static textures in the 3D video box model to obtain the 3D scene video of the target scene.
6. The device according to claim 5, characterized in that The three-dimensional scene video acquisition module is specifically used for: Obtaining location information of each channel of video frame information; According to the position information, updating the basic texture at the corresponding position in the three-dimensional video box model based on the video static texture in the off-screen canvas; The DynamicTexture class of Babylon is used to dynamically fuse and redraw the video static texture in the three-dimensional video box model to obtain the three-dimensional scene video of the target scene.
7. The device according to claim 5, characterized in that The device also includes: A model creation module, used to create a three-dimensional model of the target scene and obtain sample video frame information of the target scene; A basic texture adding module, used to use a shader editor to add the sample video frame information as a material to a corresponding position of the three-dimensional model according to the position information of the sample video frame information, so as to obtain a basic texture of the three-dimensional model; The three-dimensional video box model acquisition module is used to adjust the two-dimensional texture mapping coordinates of each pixel point of the sample video frame information in the three-dimensional model using a UV editor until the position of each pixel point in the three-dimensional model meets the preset position parameters of the three-dimensional model, thereby obtaining the three-dimensional video box model of the target scene.
8. The device according to claim 5, characterized in that The video frame acquisition module is specifically used for: In response to a user's operation of viewing the three-dimensional scene video of the target scene through a browser, sending a start-stream command to a server, wherein the start-stream command includes identifiers of multiple collectors for collecting videos of the target scene; Receiving open stream information returned by the server, wherein the open stream information includes multiple video stream data collected by each collector; Decode the video stream data of each channel to obtain multi-channel video frame information of the target scene.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-4 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
