Scene switching method and device, electronic equipment and storage medium
By using virtual window technology during scene switching, the scene switching process was optimized, the problem of poor visual effects during scene switching in the decoder was solved, and a fast, efficient and stable scene switching effect was achieved, while saving resources.
Patent Information
- Application Number
- CN202410548262.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2025-11-07
AI Technical Summary
The scene switching effect in the existing technology is not good, resulting in a poor visual experience for users. In particular, when the decoder switches from 4-screen to 16-screen, the image is uneven due to the different speeds of the camera feed.
When scene switching begins, the current frame image of the output channel is acquired and sent to a preset virtual window. The window level of the virtual window is switched to the top level. After the live window to be switched receives the corresponding video frame, the virtual window level is switched to the bottom level, and the live window is switched to the top level of the virtual window. The virtual window is used to shield the intermediate state of the live window to be switched receiving video frames.
It achieves fast, efficient and stable scene switching, improves the user's visual experience, saves resources and avoids resource waste.
Smart Images

Figure CN120915975A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a scene switching method and device, electronic equipment and a storage medium. BACKGROUND
[0002] Scene switching refers to the process of smoothly transitioning from one scene to another in image processing, video editing or multimedia applications. This switching is often used to enhance the user's visual experience.
[0003] Currently, for decoder scene switching effects, such as switching from a 4-split screen to a 16-split screen, due to the speed of the camera input stream, the Video Output (VO) channel is initially black, and the video image is displayed only after the input stream, resulting in uneven output images and affecting the user's visual experience. Therefore, the visual effect of scene switching in the prior art is poor. SUMMARY
[0004] The present application provides a scene switching method, device, electronic equipment and storage medium to solve the problem of poor visual effect of scene switching in the prior art.
[0005] The present application provides a scene switching method, comprising:
[0006] In response to a scene switching operation, a current frame image of an output channel is obtained;
[0007] The current frame image is sent to a preset virtual window, and the window level of the virtual window is switched to the top layer;
[0008] After confirming that each live window to be switched in the output channel has received the corresponding video frame, the window level of the virtual window is switched to the bottom layer, and each live window to be switched is switched to the upper layer of the virtual window to achieve scene switching.
[0009] According to the scene switching method provided by the present application, before the current frame image of the output channel is obtained in response to the scene switching operation, the method further comprises:
[0010] A virtual window is created in the output channel, and the window size of the virtual window is the same as the display area size of the output channel;
[0011] The window level of the virtual window is set to the bottom layer.
[0012] According to the scene switching method provided by the present application, when the window level of the virtual window is switched to the bottom layer after confirming that each live window to be switched in the output channel has received the corresponding video frame, it comprises:
[0013] acquire a number of corresponding video frames of each live window to be switched, the corresponding video frames comprising key frames I frames;
[0014] determine whether to switch a window level of the virtual window to a bottom layer based on the number of corresponding video frames and a preset threshold value, the preset threshold value being determined based on a number of windows of each live window to be switched.
[0015] According to the scene switching method provided by the application, the current frame image of the output channel is acquired, comprising:
[0016] if the output channel currently comprises only one live window, a live image of the live window is taken as the current frame image;
[0017] if the output channel currently comprises at least two live windows, an image obtained by splicing live images of the at least two live windows is taken as the current frame image.
[0018] According to the scene switching method provided by the application, the window level of the virtual window is switched to the bottom layer, and each live window to be switched is switched to an upper layer of the virtual window to realize scene switching, comprising:
[0019] switching the window level of the virtual window to the bottom layer, switching each live window to be switched to an upper layer of the virtual window, and adjusting a background color of the virtual window to realize scene switching.
[0020] According to the scene switching method provided by the application, after the current frame image is sent to a preset virtual window and the window level of the virtual window is switched to a top layer, the method further comprises at least one of the following:
[0021] adjusting a position of each live window to be switched;
[0022] adjusting a window level of each live window to be switched;
[0023] switching a number of split screens of the output channel from a first number to a second number.
[0024] According to the scene switching method provided by the application, the number of split screens of the output channel is switched from the first number to the second number, comprising:
[0025] adjusting a size and a position of a first number of live windows;
[0026] opening a preset number of new live windows, and receiving image frames sent by an image acquisition device, the preset number being a difference between the second number and the first number.
[0027] The application further provides a scene switching device, comprising:
[0028] an image acquisition unit configured to acquire a current frame image of the output channel in response to a scene switching operation;
[0029] an image sending unit configured to send the current frame image to a preset virtual window and switch a window level of the virtual window to a top layer;
[0030] a level switching unit configured to switch the window level of the virtual window to a bottom layer and switch each live window to be switched in the output channel to an upper layer of the virtual window to realize scene switching, in a case where it is confirmed that each live window to be switched in the output channel has received a corresponding video frame.
[0031] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the scene switching method according to any one of the above when executing the program.
[0032] The application further provides a non-transitory computer readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the scene switching method according to any one of the above.
[0033] The application further provides a computer program product comprising a computer program, wherein the computer program is executable on a processor to implement the scene switching method according to any one of the above.
[0034] The scene switching method, device, electronic device and storage medium provided by the application, by acquiring a current frame image of the output channel at the beginning of scene switching, sending the current frame image to a preset virtual window, and switching a window level of the virtual window to a top layer. The virtual window switched to the top layer currently displays the current frame image of the output channel before switching, at this time, each live window to be switched in the output channel is not in the top layer, can receive a corresponding video frame under a target scene, and the video frame receiving process cannot be seen by a user. In a case where it is confirmed that each live window to be switched has received the corresponding video frame, the window level of the virtual window is switched to a bottom layer, and each live window to be switched is switched to an upper layer of the virtual window to realize scene switching, at this time, a user sees the live window after scene switching is completed. The intermediate state of each live window to be switched receiving the corresponding video frame is shielded by the virtual window, thereby realizing optimized scene switching, high efficiency and high stability, improving a user visual effect and saving resources. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to make the technical solutions in the present application or prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0036] Figure 1 is one of the flowcharts of the scene switching method provided by the embodiments of the present application;
[0037] Figure 2 is the second flowchart of the scene switching method provided by the embodiments of the present application;
[0038] Figure 3 is the structural schematic diagram of the scene switching device provided by the embodiments of the present application;
[0039] Figure 4 is the structural schematic diagram of the electronic device provided by the present application. DETAILED DESCRIPTION
[0040] In order to make the technical solutions in the present application or prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0041] For scene switching, the decoder output in the related art is uneven, and the user visual experience is poor.
[0042] The general practice on the matrix controller is to close all time slots, keep the picture still, or reoccupy a resource as a standby switching implementation. However, this method cannot be used on the decoder because the decoder has many CPUs, which are managed separately, and the hardware modules have different VO channels, so it is difficult to close all output channels. At the same time, the method of the matrix controller is time-consuming and resource-consuming.
[0043] In the related art, all windows can be kept static frames, backup resources are re-applied to perform scene switching, and the currently displayed windows are retained. After the backup resources are applied, the currently displayed windows are released. This solution consumes resources. If the currently displayed windows are 65 and the next scene has 64 windows, 65+64 exceeds the hardware limit of 128 windows, and scene switching cannot be performed. Meanwhile, the operation of deleting the backup resources takes a long time and can be seen by the customer, and the effect is still very poor and has strong limitations. In addition, the operation of the lower windows cannot affect the upper windows, which is troublesome.
[0044] To solve the above problems, the embodiment of the present application provides a scene switching method. In the method, at the beginning of scene switching, the current frame image of the output channel is acquired first, the current frame image is sent to a preset virtual window, and the window level of the virtual window is switched to the top layer. The virtual window switched to the top layer currently displays the current frame image of the output channel before switching. At this time, the live windows to be switched in the output channel are not in the top layer, and can receive the corresponding video frames under the target scene, and the video frame receiving process cannot be seen by the user. After confirming that the corresponding video frames are received by the live windows to be switched, the window level of the virtual window is switched to the bottom layer, and the live windows to be switched are switched to the upper layer of the virtual window, so as to realize scene switching. At this time, the user sees the live windows that have completed scene switching. The intermediate state of receiving the corresponding video frames by the live windows to be switched is shielded by the virtual window, so as to realize optimized scene switching, fast and efficient and high stability, improve the visual effect of the user, and does not waste resources.
[0045] The embodiment of the present application can be applied to scenes that need to perform picture switching, such as multi-split screen switching, window level switching or window position switching. The execution subject of the method can be a terminal device, a computer, a server, a server cluster or a specially designed scene switching device, etc. electronic device, or a scene switching device provided in the electronic device. The scene switching device can be realized by software, hardware or a combination of the two.
[0046] In the description of the embodiment of the present application, it should be understood that the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features limited by "first", "second" can explicitly or implicitly include one or more of the features. In the description of the embodiment of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.
[0047] Figure 1 is one of the flowcharts of the scene switching method provided by the embodiment of the present application, asFigure 1 As shown, the method comprises the following steps:
[0048] In step 110, a current frame image of the output channel is acquired in response to a scene switching operation.
[0049] Specifically, when the scene switching operation is triggered, the current frame image of the output channel is first acquired. The operation of triggering the scene switching can include user interaction triggering, time triggering, event triggering, program logic triggering, etc., and the embodiments of the present application do not make specific limitations thereon. For example, the user can interact with the interface by clicking the button, sliding the screen, voice control, hovering gesture, etc., thereby triggering the scene switching. For another example, the scene switching is triggered according to the preset time or event, and the scene is automatically switched when the video is played to a certain time point, or the switching is triggered when a specific time notification is received.
[0050] The output channel can be a video or image input interface on a display device (such as a monitor or a projector), which is used to receive video or image signals from a video stream or a real-time image source (such as a camera, a video recorder or a computer graphics card), and display on the screen.
[0051] The current frame image refers to the image being displayed by the output channel before the scene switching operation occurs. The output channel can include one or more live windows, for example, 4, 16 or 128, etc. The current frame image can be a live image of one live window, or a real-time picture fusion of multiple live windows, which can come from the same real-time image source or from different real-time image sources, and the embodiments of the present application do not make specific limitations thereon.
[0052] In step 120, the current frame image is sent to a preset virtual window, and the window level of the virtual window is switched to the top layer.
[0053] Specifically, after the current frame image is acquired, it is sent to a preset virtual window. This virtual window can be created when the output channel is initialized. The virtual window is a simulated display area on the screen, which does not actually occupy the physical display device. After the image is sent to the virtual window, the window level of the virtual window is immediately switched to the top layer.
[0054] In actual application, in addition to the bottom layer, other window levels can be used to display live video streams or real-time image sources. Here, the other windows can be flatly displayed without hierarchical relationship, or can be hierarchically displayed with hierarchical relationship, and the embodiments of the present application do not make specific limitations thereon.
[0055] For example, in a cascaded display containing a hierarchical relationship, an output channel can open 128 windows, and numbers 0-127 can represent the hierarchy of each window, where 0 represents the bottom layer and 127 represents the top layer. Of course, the hierarchy can be flexibly set according to needs, as long as the hierarchy of the window can be identified.
[0056] It can be understood that on the display screen of the output channel, the virtual window whose window hierarchy has been switched to the top layer will cover all other windows, that is, the image content (current frame image) in the virtual window will be displayed on the display screen of the output channel.
[0057] In step 130, after confirming that the corresponding video frames are received by each live window to be switched in the output channel, the window hierarchy of the virtual window is switched to the bottom layer, and each live window to be switched is switched to the upper layer of the virtual window, so as to realize scene switching.
[0058] Specifically, since the output channel currently displays the picture of the virtual window, that is, the image frame before scene switching, the virtual window can be maintained at the top layer, and at this time, each live window to be switched in the output channel is not at the top layer, and can receive the corresponding video frame under the target scene. The video frame receiving process will not be seen by the user, that is, the intermediate state of the video frame receiving process is shielded by the virtual window. For example, due to the fast and slow of the camera stream, the picture with uneven output is shielded by the virtual window, and the user still sees the current frame image displayed by the virtual window.
[0059] After confirming that the corresponding video frames are received by each live window to be switched in the output channel, at this time, each live window has received the corresponding video frame, that is, the picture of each live window has been completely displayed. The window hierarchy of the virtual window is switched to the bottom layer, and each live window to be switched is switched to the upper layer of the virtual window, so as to realize scene switching. The current frame image in the virtual window switched to the bottom layer is no longer displayed on the output channel, and the picture content of each live window in the upper layer of the virtual window, which has received the corresponding video frame, is displayed on the output channel, thereby realizing scene switching and optimizing the visual effect of scene switching.
[0060] It should be noted that the method is applicable to all scene switching operations, has no limitations, is effective and simple, does not need to occupy a resource again, saves resources, and enhances the stability of the device.
[0061] The method provided by the embodiment of the application, at the beginning of the scene switching, acquires a current frame image of an output channel, sends the current frame image to a preset virtual window, and switches a window level of the virtual window to a top layer. The current display of the virtual window switched to the top layer is the current frame image of the output channel before the switching, at this time, each live window to be switched in the output channel is not in the top layer, can receive a corresponding video frame under a target scene, and the video frame receiving process cannot be seen by a user. After confirming that each live window to be switched receives the corresponding video frame, the window level of the virtual window is switched to a bottom layer, and each live window to be switched is switched to an upper layer of the virtual window, to realize the scene switching, at this time, the user sees the live window after the scene switching is completed. The intermediate state of each live window to be switched receiving the corresponding video frame is shielded by the virtual window, so that the scene switching is optimized, fast and efficient and high in stability, the resource is saved while the visual effect of the user is improved.
[0062] For example, on the basis of the above embodiment, before acquiring the current frame image of the output channel in response to the scene switching operation, that is, before step 110, the method further includes:
[0063] creating a virtual window in the output channel, the window size of the virtual window being the same as the display area size of the output channel;
[0064] setting the window level of the virtual window to the bottom layer.
[0065] Specifically, before responding to the scene switching operation and acquiring the current frame image of the output channel, a series of initialization operations can be performed. When the device is started, the output channel can be initialized and a virtual window can be created in the output channel.
[0066] The output channel can be a device or an interface area for displaying an image or a video stream. Initializing the output channel can include configuring parameters of the output channel, preparing display resources, and setting basic attributes of the output channel, and the like, which can be flexibly set according to the type of the output channel and application requirements.
[0067] When the output channel is initialized, a virtual window can be created in the output channel. The virtual window is a display area simulated on a software level, used for temporarily displaying an image or performing other visual processing. The window size of the virtual window is set to be the same as the display area size of the output channel, to ensure that the size of the virtual window covers the entire output channel. For example, if the output resolution of the output channel is 1080P, then the size of the virtual window is 1080P, so that the current frame image can be completely displayed in the virtual window.
[0068] After the virtual window is created, the window level of the virtual window is set to the bottom layer. At this time, the virtual window is located at the bottom of other live windows in the default state and does not block the picture content of other live windows. This can avoid disturbing the user's vision in the initial state and help keep the output channel display interface neat and clear.
[0069] Preferably, in order to make the user visually feel the virtual window, the background color of the virtual window can also be set to be the same as the initial color of the output channel, for example, both can be black. In this way, when the virtual window does not display any content or is in an idle state, its background color is integrated with other parts of the output channel and does not appear conspicuous or attract the user's attention.
[0070] The method provided in the embodiment can prepare for the scene switching operation by creating a virtual window, so as to ensure that the current frame image of the output channel can be quickly and accurately acquired during scene switching and displayed and processed through the virtual window. At the same time, the size and level of the virtual window set during the initialization process also provide a good foundation for the subsequent scene switching process.
[0071] In some embodiments, the window level of the virtual window is switched to the bottom layer after it is confirmed that the corresponding video frames are received by each live window to be switched in the output channel, including:
[0072] The number of corresponding video frames received by each live window to be switched is acquired, and the corresponding video frames include key frames I frames.
[0073] Based on the number of corresponding video frames and a preset threshold, it is determined whether to switch the window level of the virtual window to the bottom layer, and the preset threshold is determined based on the number of windows of each live window to be switched.
[0074] Specifically, the window level of the virtual window is switched to the bottom layer, and each live window to be switched is switched to the upper layer of the virtual window. This can be performed after each live window to be switched receives the corresponding video frames, so as to ensure that the virtual window does not block the picture content of other live windows, thereby realizing the display of the corresponding video frames of the live window after the scene switching in the output channel.
[0075] In the embodiment, the scene switching time can be automatically adjusted, that is, whether to switch the window level of the virtual window to the bottom layer is determined based on the number of corresponding video frames received by each live window to be switched and a preset threshold.
[0076] The corresponding video frame here includes a key frame, namely an I frame. The I frame is characterized in that it can be decoded without referring to any other frame, because it contains all the data of the image. In other words, the I frame is a full-frame compressed and encoded frame, which compresses and encodes the full image in pixels, and is a complete image frame. In a video stream, the appearance of an I frame often marks the beginning or change of a scene, because it does not depend on other frames to reconstruct the image.
[0077] The number of the corresponding video frames received by each live window to be switched can be counted. The preset threshold is determined based on the number of windows of each live window to be switched. For example, if the number of windows of each live window to be switched is 16, the preset threshold can be 90% of the number of windows, namely 14.
[0078] The number of the corresponding video frames can be compared with the preset threshold. If the number of the corresponding video frames is greater than or equal to the preset threshold, it indicates that most of the live windows to be switched have received the corresponding video frames, at this time, the window level of the virtual window can be switched to the bottom layer, and each live window to be switched can be switched to the upper layer of the virtual window to realize scene switching.
[0079] If the number of the corresponding video frames is less than the preset threshold, it indicates that most of the live windows to be switched have not received the corresponding video frames, at this time, the corresponding video frames can be waited to continue to be received, and when the number of the corresponding video frames is greater than or equal to the preset threshold, the window level of the virtual window can be switched to the bottom layer, and each live window to be switched can be switched to the upper layer of the virtual window to realize scene switching.
[0080] The method provided by the embodiment of the application can automatically adjust the scene switching time by comparing the number of the corresponding video frames with the preset threshold, and switching the window level of the virtual window to the bottom layer and switching each live window to be switched to the upper layer of the virtual window, so that a better visual effect can be achieved.
[0081] In some possible implementation manners, the current frame image of the output channel is obtained, including:
[0082] If the output channel currently includes only one live window, the live image of the live window is taken as the current frame image;
[0083] If the output channel currently includes at least two live windows, the image obtained by splicing the live images of the at least two live windows is taken as the current frame image.
[0084] Specifically, when the scene switching operation starts to be executed, the current frame image of the output channel can be obtained by a gray-scale module on the hardware, i.e., the WBC module. Each output channel can include one or more live windows, which can respectively display different images or video streams. In order to obtain the current frame image of the entire output channel, the current frame live image of each live window needs to be obtained first. This can be achieved by calling the relevant image capture or video stream processing interface.
[0085] If the output channel currently includes only one live window, the live image of the live window is taken as the current frame image.
[0086] If the output channel currently includes at least two live windows, the image obtained by splicing the live images of the at least two live windows is taken as the current frame image. The purpose of splicing is to combine the images of the live windows according to their relative positions in the output channel to form a complete current frame image. First, the positions and sizes of the live windows in the output channel are determined, which can be determined by the coordinate and size information of the windows. According to this, the position and size of each live image in the spliced image are calculated. Each live image is drawn on a new blank image according to the calculated position and size. After the drawing of all live images is completed, the obtained image is the complete image of the current frame output channel, i.e., the current frame image.
[0087] It should be noted that in the splicing process, the transition effect between the live images, the processing of the overlapping area, etc. can be further considered to ensure that the current frame image obtained after splicing is visually coherent and natural.
[0088] Based on any of the above embodiments, the window level of the virtual window is switched to the bottom layer, and each live window to be switched is switched to the upper layer of the virtual window to realize scene switching, including:
[0089] The window level of the virtual window is switched to the bottom layer, each live window to be switched is switched to the upper layer of the virtual window, and the background color of the virtual window is adjusted to realize scene switching.
[0090] Specifically, in order to achieve better visual effect and make the user feel that the virtual window is visually indistinguishable, when the window level of the virtual window is switched to the bottom layer and each live window to be switched is switched to the upper layer of the virtual window, the background color of the virtual window can also be adjusted. The background color of the virtual window can be set to be the same as the initial color of the output channel, for example, both can be black. In this way, it can be ensured that when the virtual window does not display any content or is in an idle state, its background color is integrated with other parts of the output channel and does not appear conspicuous or attract the user's attention.
[0091] On the basis of the above embodiments, after sending the current frame image to the preset virtual window and switching the window level of the virtual window to the top layer, the method further comprises at least one of the following:
[0092] adjusting the positions of the live windows to be switched;
[0093] adjusting the window levels of the live windows to be switched;
[0094] switching the number of split screens of the output channel from the first number to the second number.
[0095] Specifically, the scene switching of the live windows can be performed after the window level of the virtual window is switched to the top layer. The scene switching can include adjusting the positions of the live windows. The position adjustment can be based on the personalized needs of the user or the consideration of the interface design. By adjusting the positions of the live windows, it can be made more in line with the operation habits or visual habits of the user, improving the user experience. In specific implementation, the position adjustment can be directly performed on the interface through dragging, clicking or sliding, etc. In addition, preset layout templates can also be provided for the user to quickly select and apply.
[0096] The scene switching can also include adjusting the window levels of the live windows. The adjustment of the window level can affect the display order and occlusion relationship of the live windows on the interface. By adjusting the window level, it can be ensured that important windows are always displayed in the front position, or some windows are hidden or displayed as needed. In specific implementation, the window level attribute can be set or a special level adjustment tool can be used to achieve this.
[0097] The scene switching can also include split screen operation on the live windows. Split screen operation is a technology that divides the screen into multiple areas and displays different windows in each area. By performing split screen operation on the live windows, the simultaneous display of multiple windows can be achieved, which is convenient for the user to compare and view the contents of different windows. In specific implementation, a variety of split screen layouts can be provided for the user to choose from, such as two-split screen, three-split screen, etc. The layout and size of the split screen can also be customized as needed.
[0098] On the basis of the above embodiments, the split screen operation on the live windows comprises:
[0099] Switching the number of split screens of the output channel from the first number to the second number, for the size relationship between the first number and the second number, the embodiment does not make specific limitation. That is, it can be switched from more split screens to less split screens, or from less split screens to more split screens, and the present embodiment does not make specific limitation.
[0100] Specifically, according to the user demand or interface design, the number of split screens to be switched to, i.e., the second number, is determined. According to the specific values of the first number and the second number, a suitable split screen mode is selected. For example, if the first number is 8 and the second number is 2, the split screen mode can be switched from 8 to 2; if the first number is 4 and the second number is 16, the split screen mode can be switched from 4 to 16, and so on.
[0101] During the switching of the number of split screens, the size and position of each live window can be automatically adjusted to adapt to the new split screen layout. At the same time, overlapping between windows or excessive blank areas can be avoided. After the switching of the number of split screens is completed, it can be confirmed whether the new split screen effect meets the demand and whether the display content of each window is complete and clear.
[0102] In this embodiment, since the split screen switching operation is performed under the virtual window, the virtual window shields the intermediate state of the split screen switching process, and the entire split screen switching process is fast, efficient and stable from the user's visual perspective.
[0103] In some possible implementations, switching the live windows of the output channel from the first number to the second number includes:
[0104] adjusting the size and position of the first number of live windows;
[0105] opening a preset number of new live windows and receiving image frames sent by the image acquisition device, the preset number being the difference between the second number and the first number.
[0106] Specifically, switching the live windows of the output channel from the first number to the second number usually requires adjusting the position of the existing windows and opening new windows to receive new image frames.
[0107] Here, the first number of live windows are existing windows. First, based on the requirement of the second number, a new window layout is determined. According to the new layout, the size and position of the first number of existing live windows are moved and adjusted one by one. This can be achieved by dragging, clicking or using a special adjustment tool. It is ensured that each window is placed at the specified position in the new layout.
[0108] Then, according to the difference between the second quantity and the first quantity, the quantity of new windows (preset quantity) to be opened is calculated. A corresponding quantity of new live windows are created and started in the system. This can be achieved by clicking the add window button on the interface or using the related command. The necessary parameters and settings of the newly opened windows are configured, such as window size, position, transparency, etc. Ensure that each newly opened window is connected with the corresponding image acquisition device. The connection with the image acquisition device can be established through TCP or UDP. Once the connection is successful, the new window can start receiving image frames from the image acquisition device. The device side waits for the image acquisition device to send the stream, and creates a decoding channel, a scaling channel, and sends the data to the output channel.
[0109] Based on any of the above embodiments, taking switching from 4-split screen to 16-split screen as an example, a scene switching method is provided, Figure 2 is a flowchart of the scene switching method provided by the embodiments of the present application, as shown in Figure 2 The method comprises the following steps:
[0110] A virtual window is created at the time of VO initialization when the device starts. The size of the window covers the entire VO. For example, if the output resolution is 1080P, then the size of the virtual window is 1080P, and the window is blacked out and placed at the bottom level.
[0111] A VO module can open 128 windows. Except for the bottom layer, the levels of other windows can be used to display live (i.e. images sent by the camera). When the scene switching operation starts to be executed, a frame of image of all windows spliced together, i.e. the current frame image, is first obtained through the WBC module (a gray display module on the hardware, which can obtain the current image sent to the display). The current frame image is sent to the virtual window placed at the bottom layer.
[0112] Then the bottom layer virtual window needs to switch levels. The level of the virtual window is switched to the top layer, for example, the level is set to 127.
[0113] The position of the 4-split screen window is adjusted, and it is roamed to a new position. Then 12 windows are opened again. These 12 windows need to build a stream, and a connection is established with the camera through TCP or UDP. The device side waits for the camera to send the stream, and a decoding channel, a scaling channel, and a VO are created to send the data. Due to the reason that the virtual window is placed at the top, the customer will not see any operation in the scene switching process when the 4-split screen is switched to the 16-split screen.
[0114] The device side will count the number of live I frames. When the number of code streams in the 16 windows exceeds 90%, that is, 14 I frames are received, the virtual window is canceled and the virtual window level is switched to the bottom layer, for example, the window level is set to 0. This operation is very fast and can be completed within 33 ms. After the operation is performed, the user will see the 16-split screen after switching.
[0115] It should be noted that the optimization scheme of scene switching provided by the embodiment does not increase the time of scene switching, and all the increased operations are very fast, including switching the level, obtaining the WBC module data, which is very fast and can be completed within a frame. It can improve the user's visual experience. And the scheme is suitable for various scene switching, not just the split screen switching listed above. No matter how many windows there are and how complex the window operation is, scene switching can be achieved through virtual windows, for example, there is overlap between windows, the level switching is complex, or the window position changes greatly. Scene switching operation is also applicable.
[0116] The scene switching device provided by the application will be described below. The scene switching device described below can be referred to each other corresponding to the scene switching method described above.
[0117] Figure 3 The structure diagram of the scene switching device provided by the embodiment of the application is shown in Figure 3 As shown in the figure, a scene switching device is provided, which comprises:
[0118] The image acquisition unit 310 is configured to acquire the current frame image of the output channel in response to the scene switching operation.
[0119] The image sending unit 320 is configured to send the current frame image to the preset virtual window and switch the window level of the virtual window to the top layer.
[0120] The level switching unit 330 is configured to switch the window level of the virtual window to the bottom layer and switch the to-be-switched live windows to the upper layer of the virtual window to realize scene switching, in the case that the to-be-switched live windows in the output channel receive corresponding video frames.
[0121] In an example embodiment, the scene switching device further comprises a window creation unit configured to:
[0122] create the virtual window in the output channel, the window size of the virtual window being the same as the display area size of the output channel;
[0123] set the window level of the virtual window to the bottom layer.
[0124] In an example embodiment, the level switching unit is specifically configured to:
[0125] acquire a number of corresponding video frames received by each live window to be switched, the corresponding video frames including key frames I frames;
[0126] determine whether to switch the window level of the virtual window to a bottom layer based on the number of corresponding video frames and a preset threshold, the preset threshold being determined based on a number of windows of each live window to be switched.
[0127] In an example embodiment, the level switching unit is specifically configured to:
[0128] switch the window level of the virtual window to the bottom layer, switch each live window to be switched to an upper layer of the virtual window, and adjust a background color of the virtual window to realize scene switching.
[0129] In an example embodiment, the image acquisition unit is specifically configured to:
[0130] if the output channel currently includes only one live window, the live image of the live window is taken as the current frame image;
[0131] if the output channel currently includes at least two live windows, an image obtained by splicing live images of the at least two live windows is taken as the current frame image.
[0132] In an example embodiment, the scene switching device further includes a scene switching unit configured to:
[0133] adjust a position of each live window to be switched;
[0134] adjust a window level of each live window to be switched;
[0135] switch a number of split screens of the output channel from a first number to a second number.
[0136] In an example embodiment, the scene switching unit is specifically configured to:
[0137] adjust a size and a position of a first number of live windows;
[0138] open a preset number of new live windows, and receive image frames sent by an image acquisition device, the preset number being a difference between the second number and the first number.
[0139] The apparatus of this embodiment can be used to execute the method of any embodiment in the scene switching method side embodiment. Its specific implementation process and technical effects are similar to those in the scene switching method side embodiment. For details, please refer to the detailed description in the scene switching method side embodiment, which will not be repeated here.
[0140] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a scene switching method, which includes:
[0141] In response to scene switching operations, obtain the current frame image of the output channel;
[0142] The current frame image is sent to a preset virtual window, and the window level of the virtual window is switched to the top level;
[0143] Once it is confirmed that each live window to be switched in the output channel has received the corresponding video frame, the window level of the virtual window is switched to the bottom layer, and each live window to be switched is switched to the top layer of the virtual window to achieve scene switching.
[0144] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0145] In another aspect, the present application also provides a computer program product comprising a computer program, which can be stored on a non-transitory computer readable storage medium, and the computer program is executable by a processor to enable a computer to perform the scene switching method provided by the above-mentioned methods, which comprises:
[0146] In response to a scene switching operation, a current frame image of an output channel is acquired;
[0147] The current frame image is sent to a preset virtual window, and a window level of the virtual window is switched to a top layer;
[0148] In a case where each live window to be switched in the output channel receives a corresponding video frame, the window level of the virtual window is switched to a bottom layer, and each live window to be switched is switched to an upper layer of the virtual window to realize scene switching.
[0149] In another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, and the computer program is executable by a processor to implement the scene switching method provided by the above-mentioned methods, which comprises:
[0150] In response to a scene switching operation, a current frame image of an output channel is acquired;
[0151] The current frame image is sent to a preset virtual window, and a window level of the virtual window is switched to a top layer;
[0152] In a case where each live window to be switched in the output channel receives a corresponding video frame, the window level of the virtual window is switched to a bottom layer, and each live window to be switched is switched to an upper layer of the virtual window to realize scene switching.
[0153] The device embodiments described above are only schematic, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., they can be located in one place or distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme. Those skilled in the art can understand and implement it without creative labor.
[0154] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0155] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of scene switching, characterized by, The method comprises the following steps: in response to a scene switching operation, acquiring a current frame image of an output channel; sending the current frame image to a preset virtual window, and switching a window level of the virtual window to a top layer; in a case where each live window to be switched in the output channel receives a corresponding video frame, switching the window level of the virtual window to a bottom layer, and switching each live window to be switched to an upper layer of the virtual window to realize scene switching.
2. The scene change method of claim 1, wherein, Before the step of acquiring the current frame image of the output channel in response to the scene switching operation, the method further comprises the following steps: creating the virtual window in the output channel, wherein a window size of the virtual window is the same as a display area size of the output channel; setting the window level of the virtual window to the bottom layer.
3. The scene change method of claim 1, wherein, The step of switching the window level of the virtual window to the bottom layer in a case where each live window to be switched in the output channel receives a corresponding video frame comprises the following steps: acquiring a number of corresponding video frames received by each live window to be switched, wherein the corresponding video frames comprise key frames I frames; based on the number of corresponding video frames and a preset threshold value, determining whether to switch the window level of the virtual window to the bottom layer, wherein the preset threshold value is determined based on a window number of each live window to be switched.
4. The scene changeover method according to any one of claims 1 to 3, characterized by, The step of acquiring the current frame image of the output channel comprises the following steps: if the output channel currently comprises only one live window, taking a live image of the live window as the current frame image; if the output channel currently comprises at least two live windows, taking an image obtained by splicing live images of the at least two live windows as the current frame image.
5. The scene change method according to any one of claims 1 to 3, wherein, The step of switching the window level of the virtual window to the bottom layer, switching each live window to be switched to an upper layer of the virtual window, and realizing scene switching comprises the following steps: switching the window level of the virtual window to the bottom layer, switching each live window to be switched to the upper layer of the virtual window, and adjusting a background color of the virtual window to realize scene switching.
6. The scene change method according to any one of claims 1 to 3, wherein, After the step of sending the current frame image to the preset virtual window and switching the window level of the virtual window to the top layer, the method further comprises at least one of the following steps: adjusting positions of each live window to be switched; adjusting window levels of each live window to be switched; switching a split screen number of the output channel from a first number to a second number.
7. The scene change method of claim 6, wherein, The step of switching the split screen number of the output channel from the first number to the second number comprises the following steps: adjusting sizes and positions of the first number of live windows; opening a preset number of new live windows, and receiving image frames sent by an image acquisition device, wherein the preset number is a difference between the second number and the first number.
8. A scene change apparatus characterized by comprising: The method comprises the following steps: an image acquisition unit is configured to acquire a current frame image of an output channel in response to a scene switching operation; an image sending unit is configured to send the current frame image to a preset virtual window, and switch a window level of the virtual window to a top layer; A hierarchy switching unit is configured to switch the window hierarchy of the virtual window to a bottom layer and switch each live window to be switched in the output channel to an upper layer of the virtual window to realize scene switching when it is confirmed that each live window to be switched in the output channel receives a corresponding video frame.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the scene switching method of any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the scene switching method of any one of claims 1 to 7 when executed by the processor.
Citation Information
Patent Citations
Method and system for quickly switching window layout
CN102063281A
Method and device for displaying and switching multiple windows
CN104077016A
Multi-video-window hierarchy switching method and device
CN105491452A
Information source fast switching method, television device and memory medium
CN107484014A
Video image switching method and device, electronic device and storage medium
CN109963188A