OSD overlay method, apparatus, device, and medium
Patent Information
- Application Number
- CN202510407152.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]本发明提供了一种OSD叠加方法、装置、设备和介质,以解决OSD叠加过程中导致的视频帧关键信息覆盖的问题
[0019] The technical solution of this invention determines the motion prediction results of the detection target and the dynamic background by analyzing the current and historical detection results of the detection target and the dynamic background, and determines the non-overlay area by combining the current detection results and the motion prediction results, thereby dynamically adjusting the OSD overlay position to avoid covering key information on the detection target and the dynamic background that are in motion.
Smart Images

Figure CN122933842A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an OSD overlay method, apparatus, device, and medium. Background Technology
[0002] In video surveillance systems, OSD (On-Screen Display) overlay is used to display text, graphics, and other information on video frames, such as location information, time information, or label information. Existing OSD overlay methods typically fix the overlaid content to a specific area within the video frame. However, this fixed-position approach can lead to the overlay of important information in the video, especially when there are constantly moving targets in the video. For example, when a pedestrian or vehicle passes through the area, the OSD overlay content may cover the pedestrian's face or the vehicle's license plate information. Summary of the Invention
[0003] This invention provides an OSD overlay method, apparatus, device, and medium to solve the problem of key information overlay in video frames during OSD overlay.
[0004] According to one aspect of the present invention, an OSD overlay method is provided, comprising:
[0005] The target and dynamic background in the target frame of the target video are detected to obtain a first detection result, and the detection results of the target and dynamic background in the second preset number of frames preceding the target frame are obtained as historical detection results.
[0006] Based on the first detection result and the historical detection results, determine the motion prediction results of the detection target and the dynamic background;
[0007] Based on the first detection result and the motion prediction result, the non-overlapping region in the target frame is determined, and based on the non-overlapping region in the target frame, the set of overlapping positions in the target frame is determined;
[0008] Based on the target overlay content in the target frame, the target overlay area is determined from the set of overlayable positions.
[0009] According to another aspect of the present invention, an OSD overlay device is provided, comprising:
[0010] The detection result determination module is used to detect the target and dynamic background in the target frame of the target video to obtain a first detection result, and to obtain the detection results of the target and dynamic background in a second preset number of preceding frames of the target frame as historical detection results.
[0011] The motion prediction module is used to determine the motion prediction result of the detected target and the dynamic background based on the first detection result and the historical detection result;
[0012] The superimposable position determination module is used to determine the non-superimposable region in the target frame based on the first detection result and the motion prediction result, and to determine the superimposable position set in the target frame based on the non-superimposable region in the target frame;
[0013] The target overlay position determination module is used to determine the target overlay area from the set of overlayable positions based on the target overlay content in the target frame.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] At least one processor; and
[0016] A memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the OSD overlay method according to any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the OSD overlay method according to any embodiment of the present invention.
[0019] The technical solution of this invention determines the motion prediction results of the detection target and the dynamic background by analyzing the current and historical detection results of the detection target and the dynamic background, and determines the non-overlay area by combining the current detection results and the motion prediction results, thereby dynamically adjusting the OSD overlay position to avoid covering key information on the detection target and the dynamic background that are in motion.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an OSD overlay method provided according to an embodiment of the present invention;
[0023] Figure 2 This is a schematic diagram of the first detection result and the motion prediction result;
[0024] Figure 3 This is a flowchart of another OSD overlay method provided according to an embodiment of the present invention;
[0025] Figure 4 This is a flowchart of another OSD overlay method provided according to an embodiment of the present invention;
[0026] Figure 5 This is a flowchart of another OSD overlay method provided according to an embodiment of the present invention;
[0027] Figure 6 This is a schematic diagram of the structure of an OSD overlay device according to an embodiment of the present invention;
[0028] Figure 7 This is a schematic diagram of the structure of an electronic device that implements the OSD overlay method of this invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "candidate," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] Figure 1This invention provides a flowchart of an OSD overlay method, applicable to situations where text, graphics, and other information are overlaid on video frames. The method can be executed by an OSD overlay device, which can be implemented in hardware and / or software and configured in a server with computing capabilities. Figure 1 As shown, the method includes:
[0032] S110. Detect the target and dynamic background in the target frame of the target video to obtain the first detection result, and obtain the detection results of the target and dynamic background in the second preset number of preceding frames of the target frame as historical detection results.
[0033] In this context, the target frame of the target video refers to the image frame in the target video that requires OSD overlay. The target video can be a continuous video captured by a surveillance camera, and the target frame can be any frame or keyframe in the target video. The detected target refers to the object to be identified in the target video, i.e., the foreground object. For example, in surveillance video, the detected targets are pedestrians and vehicles. The detected targets in the target video are different in different scenarios, and the type of detected target can be determined according to the actual scenario requirements.
[0034] Dynamic backgrounds refer to background objects that exhibit significant movement or change within the background region of a video frame sequence; they are not completely static. These moving or changing background objects can carry crucial information. Changes in dynamic backgrounds can be caused by natural or human factors, intertwining with the movement of foreground detection targets (such as pedestrians and vehicles), making the distinction between dynamic background targets and foreground detection targets more complex. For example, animals straying into traffic or traffic lights are dynamic backgrounds. The alternating colors (red, yellow, green) and countdowns of traffic lights influence the movement of foreground detection targets, thus serving as important evidence in traffic accident liability determinations. Therefore, if dynamic background areas are covered by OSD (On-Site Display) overlay content, crucial information will be lost.
[0035] Specifically, the detection target type and dynamic background type in the target video are determined. Based on the detection target type and dynamic background type, the detection target features and dynamic background features are determined. Based on the detection target features and dynamic background features, feature recognition is performed on the target frames of the target video. The detection target result and dynamic background result with feature matching are determined as the first detection result. The first detection result includes the type and location information of the detection target and dynamic background.
[0036] For example, a detection model is pre-trained, and target frames from the target video are input into the model. The model then identifies the target objects and dynamic backgrounds within the target frames, and its output is the first detection result. Deep learning models, especially convolutional neural networks (CNNs), have strong feature extraction capabilities when processing dynamic background detection in videos. Through extensive training data, CNNs can learn complex patterns and dynamic changes, thereby recognizing dynamic backgrounds in videos.
[0037] The second pre-set number of frames refers to a preset number of pre-set frames preceding the target frame. The number of frames in the second pre-set number of frames can be determined according to actual detection requirements. The first and second pre-set number of frames can be the same or different. OSD overlay information may or may not be present on the second pre-set number of frames.
[0038] The detection results of the detected target and dynamic background in each of the two preceding frames are obtained as historical detection results. That is, the historical detection results include the type information of each detected target and dynamic background as well as the tracking position information.
[0039] S120. Determine the motion prediction results of the detection target and dynamic background based on the first detection result and the historical detection results.
[0040] Since the detected target and dynamic background are not static, overlaying the OSD onto the possible movement positions of the detected target and dynamic background within a preset time period after the target frame will also cause occlusion of critical information (because the detection of the target and dynamic background is not performed in every frame, if the target overlay area determined in the target frame is still used for OSD overlay within the preset time period after the target frame, critical information will be occluded). Furthermore, if the OSD overlay position changes frequently with the position of the detected target and dynamic background, the human eye must constantly adjust the focus to track the OSD overlay position, which can easily cause eye fatigue.
[0041] Specifically, based on the tracking position information of each detected target and dynamic background in the historical detection results and the first detection results, the trajectory information and velocity information of each detected target and dynamic background are determined. Based on the trajectory information and velocity information, the predicted position information of the detected target and dynamic background within a preset time period is determined, and the predicted position information is used as the motion prediction result.
[0042] like Figure 2 The image shows a schematic diagram of the first detection result and the motion prediction result. Figure 2 The green area represents the location of each detected target and dynamic background in the first detection result, while the purple area represents the predicted location information of each detected target and dynamic background, i.e., the motion prediction result.
[0043] For example, based on the coordinates of the target vehicle A at historical time T0, the speed of vehicle A can be obtained using the formula V(speed) = S(distance) / T(time). From this, the coordinates at future time T2 can be inferred, determining the approximate range. Assuming the coordinates of the top-left corner, bottom-right corner, and center point of vehicle A at time T0 are (100, 400), (200, 600), and (150, 500), respectively, and the coordinates of the top-left corner, bottom-right corner, and center point of vehicle A at time T1 are (200, 400), (300, 600), and (250, 500), and the time difference between T1 and T0 is 200ms, then the speed of vehicle A is 500 pixels per second. Based on this speed, the predicted position range of the top-left corner coordinate of vehicle A in the x-direction over the next 5 frames is [300, 700]. Alternatively, a target tracking model can be trained by inputting historical detection results and the first detection result into the target tracking model. The target tracking model predicts the position information within a preset time period based on the type and position information of each detected target and dynamic background. The model outputs the predicted position information within a preset time period after the target frame, which serves as the motion prediction result.
[0044] S130. Determine the non-overlapping regions in the target frame based on the first detection result and motion prediction result, and determine the set of overlapping positions in the target frame based on the non-overlapping regions in the target frame.
[0045] Since the first detection result includes the current position information of the detected target and the dynamic background in the current frame, and the motion prediction result includes the predicted position information of the detected target and the dynamic background after the target frame, both the current position information and the predicted position information will include key information. In the current frame, the area within a preset distance range around the current position information and the corresponding predicted position information is determined as the non-overlapping area, and the other areas in the current frame other than the non-overlapping area are determined as the set of overlapping positions in the target frame.
[0046] In one feasible embodiment, determining the non-overlayable region in the target frame based on the first detection result and the motion prediction result includes:
[0047] Based on the motion prediction results, determine the predicted position information of the detected target and dynamic background within a preset time period after the target frame;
[0048] The positional information of the detected target and dynamic background in the first detection result, as well as the predicted positional information within a preset time period after the target frame, are taken as the non-overlapping region in the target frame.
[0049] The motion prediction trajectory of the detected target and the dynamic background is determined based on the motion prediction results. The predicted position information of the detected target and the dynamic background within a prediction time period after the target frame is then determined based on the motion prediction trajectory. For example, a motion prediction model is pre-trained, and the first detection result and historical detection results are input into the model. The model then obtains the predicted position information within a preset future time period based on the position information and type of the detected target and the dynamic background.
[0050] The current position information of the detected target and the dynamic background in the current frame is taken as the non-overlay region. Similarly, since there may be a certain time gap between the motion changes of the detected target and the dynamic background and the overlay detection, in order to avoid occluding key information in the future preset time period, the predicted position information of the detected target and the dynamic background in the preset time period after the target frame is also taken as the non-overlay region on the current frame.
[0051] Specifically, the first detection result includes at least the current position information of the detected target and the dynamic background, while the motion prediction result includes the predicted position information of the detected target and the dynamic background over a preset time period. Since both the detected target and the dynamic background contain critical information that cannot be occluded, in order to improve the preservation of critical information, the current position information of the detected target and the dynamic background in the first detection result and the predicted position information in the motion prediction result are considered as non-overlapping regions in the target frame; the other regions in the target frame besides the non-overlapping regions are considered as the set of overlapping locations in the target frame.
[0052] For example, corresponding Figure 2 The green and purple regions in the target frame are identified as non-overlapping regions. The remaining regions in the target frame, excluding the non-overlapping regions, constitute the set of overlapping locations. Optionally, the blank regions other than the non-overlapping regions are connected. If the area of any connected region is smaller than the area of the minimum overlapping region, the region containing that connected region is determined to be a non-overlapping region, and the remaining blank regions constitute the set of overlapping locations. Pre-excluding non-overlapping regions by using the area of connected regions avoids small blank regions caused by the close proximity of the detected target and the dynamic background affecting the determination of subsequent target overlapping locations, reducing computational waste caused by invalid overlapping blank regions, and improving the efficiency of target overlapping region determination. The minimum overlapping region area is determined based on the target overlapping content and is not limited to a specific value.
[0053] Based on historical detection results and the first detection result, the motion state of each detection target and dynamic background is determined. Based on the motion state, the movement trajectory and speed of each detection target and dynamic background are determined. The predicted position information of each detection target and dynamic background in the future is predicted. When OSD content is superimposed on the target frame, the predicted position information is also marked as a non-superimposed area, which ensures that the OSD will not jump frequently within the preset time period, which is more friendly to human vision.
[0054] By marking the dynamic background area and the detection target area in the surveillance video, the motion trend of the dynamic background and the detection target is predicted, and the non-overlapping area is marked according to the motion trend, which improves the stability of the OSD overlay position on the target frame.
[0055] S140. Determine the target overlay area from the set of overlayable positions based on the target overlay content in the target frame.
[0056] Based on the target overlay content, determine the optimal overlay area size parameters for visual effect. Then, traverse the set of possible overlay locations based on these parameters to identify candidate overlay areas that meet the size requirements. These candidate overlay areas include their location information, which may include the top-left corner or center point. From these candidate overlay areas, determine a target overlay area, for example, selecting the candidate overlay area closest to the previous historical overlay area.
[0057] The technical solution of this invention determines the motion prediction results of the detection target and the dynamic background by analyzing the current and historical detection results of the detection target and the dynamic background, and determines the non-overlay area by combining the current detection results and the motion prediction results, thereby dynamically adjusting the OSD overlay position to avoid covering key information on the detection target and the dynamic background that are in motion.
[0058] Figure 3 This is a flowchart of another OSD overlay method provided by an embodiment of the present invention. This embodiment further refines the determination of the target overlay region from the set of overlayable positions in the above embodiment.
[0059] S310. Detect the target and dynamic background in the target frame of the target video to obtain the first detection result, and obtain the detection results of the target and dynamic background in the second preset number of preceding frames of the target frame as historical detection results.
[0060] S320. Determine the motion prediction results of the detection target and dynamic background based on the first detection result and the historical detection results.
[0061] S330. Determine the non-overlapping regions in the target frame based on the first detection result and motion prediction result, and determine the set of overlapping positions in the target frame based on the non-overlapping regions in the target frame.
[0062] S340. Based on the historical OSD overlay information of the target video and the target overlay content in the target frame, determine the target overlay area from the set of overlayable positions.
[0063] Historical OSD overlay information refers to the OSD overlay information of the preceding frames in the target video, such as the OSD overlay position information, overlay area size information, and overlay time information of the preceding frames. Target overlay content refers to the text or graphic information to be overlaid on the target frame. The target overlay content can be determined based on the actual scene, and there are no restrictions on how the target overlay content is determined.
[0064] The size parameters of the overlay region are determined based on the target overlay content in the target frame. Based on the historical OSD overlay information and the size parameters of the overlay region, the overlayable region in the set of overlayable positions is determined to be the one that simultaneously meets the size condition of the overlay region size parameters and the condition that it is the closest to the historical OSD overlay region in the historical OSD overlay information. The target overlay region is determined based on the position information of the overlayable region.
[0065] For example, the historical OSD overlay information is the historical OSD overlay position information on the previous frame of the target frame. From the set of possible overlay positions, a possible overlay region that is closest to the historical OSD overlay position information and has a size parameter greater than or equal to the overlay region size parameter is determined. The target overlay region is then determined based on the position information of this possible overlay region. If no suitable overlay region is determined based on this condition, the overlay region size parameter is reduced.
[0066] By determining the target overlay area on the target frame using historical OSD overlay information, the OSD overlay position will not exhibit continuous long-distance jumps, thereby improving the visual effect for the human eye.
[0067] The technical solution of this invention determines the target overlay area based on historical OSD overlay information, which improves the stability of the OSD overlay position, significantly enhances the OSD display effect, and avoids visual discomfort caused by frequent long-distance movement of the OSD overlay position.
[0068] Figure 4 This is a flowchart of another OSD overlay method provided by an embodiment of the present invention. This embodiment further refines the historical OSD overlay information in the above embodiment. The historical OSD overlay information includes at least the location information of all historical OSD overlay areas and the overlay duration.
[0069] The historical OSD overlay information of the target video includes the location information of the historical OSD overlay regions on all preceding frames in the target video, as well as the overlay duration. The overlay duration is the cumulative overlay duration of the historical OSD overlay region or the longest consecutive duration; the location information of the historical OSD overlay region is represented by the coordinates of the upper left and lower right corners of the region.
[0070] like Figure 4 As shown, the method includes:
[0071] S410. Detect the target and dynamic background in the target frame of the target video to obtain the first detection result, and obtain the detection results of the target and dynamic background in the second preset number of preceding frames of the target frame as historical detection results.
[0072] S420. Determine the motion prediction results of the detection target and dynamic background based on the first detection result and the historical detection results.
[0073] S430. Determine the non-overlapping regions in the target frame based on the first detection result and motion prediction result, and determine the set of overlapping positions in the target frame based on the non-overlapping regions in the target frame.
[0074] S440. Determine at least two candidate overlay regions from the set of overlayable locations based on the target overlay content.
[0075] S450. Sort the historical OSD overlay areas in descending order according to the overlay duration to obtain the first sorting result of the historical OSD overlay areas.
[0076] The historical OSD overlay areas are sorted according to their overlay duration. In the first sorting result, the historical OSD overlay areas with longer overlay durations are ranked higher.
[0077] S460. Based on the first sorting result, according to the location information of each historical OSD overlay area and the location information of the candidate overlay area, the influence parameters of each historical OSD overlay area on each candidate overlay area are determined in sequence, and the target overlay area is determined from the candidate overlay area according to the influence parameters.
[0078] Based on the order of historical OSD overlay areas in the first ranking result, the influence parameters of each historical OSD overlay area on each candidate overlay area are determined. These influence parameters represent the degree to which the position of the historical OSD overlay area visually affects the display effect corresponding to the candidate overlay position. These influence parameters can be determined based on the overlapping area and / or distance between the historical OSD overlay area and the candidate overlay position. Based on the order of historical OSD overlay areas in the first ranking result, the candidate overlay area whose influence parameters first meet the preset parameter conditions is determined as the target overlay area. The preset parameter conditions are determined based on the specific content of the influence parameters. For example, if the influence parameters are determined based on overlapping area, the preset parameter condition is that the overlapping area is greater than a preset area threshold; if the influence parameters are determined based on distance, the preset parameter condition is that the distance is less than a preset distance threshold.
[0079] Specifically, following the order of historical OSD overlay regions in the first sorting result, the influence parameters of the first-ranked historical OSD overlay region on each candidate overlay region are first determined. If no candidate overlay region whose influence parameters meet the preset parameter conditions are determined, the influence parameters of the next historical OSD overlay region on each candidate overlay region are determined according to the first sorting result. If no candidate overlay region is determined after traversing all OSD overlay regions, the preset parameter conditions are modified, i.e., the value of the preset area threshold is decreased or the value of the preset distance threshold is increased. If a candidate overlay region that meets the preset parameter conditions is determined based on the influence parameters of any historical OSD overlay region on each candidate overlay region, then this candidate overlay region is taken as the target overlay region. If at least two candidate overlay regions that meet the preset parameter conditions are determined based on the influence parameters of any historical overlay region on each candidate overlay region, then the target overlay region is determined from these at least two candidate overlay regions based on the value of the influence parameters. For example, the candidate overlay region with the largest overlapping area is determined from these at least two candidate overlay regions as the target overlay region; or the candidate overlay region with the smallest distance is determined from these at least two candidate overlay regions as the target overlay region.
[0080] In one feasible embodiment, S460 includes:
[0081] Based on the first sorting result, the overlapping area of each historical OSD overlay area and each candidate overlay area is determined sequentially according to the location information of each historical OSD overlay area and the location information of the candidate overlay area, and the overlapping area is used as the influencing parameter.
[0082] Based on the order of determining the overlapping area, if the overlapping area between any candidate overlay area and the historical OSD overlay area is greater than a preset area threshold, then the candidate overlay area is determined as the target overlay area.
[0083] According to the order of historical OSD overlay regions in the first sorting result, the first historical OSD overlay region, i.e., the historical OSD overlay region with the longest overlay duration, is determined first, and the overlapping area of each candidate overlay region is determined. If the overlapping area of all candidate overlay regions with the historical OSD overlay region with the longest overlay duration is less than or equal to the preset area threshold, then the next historical OSD overlay region is determined according to the first sorting result, i.e., the overlapping area of the historical OSD overlay region with the second longest overlay duration and each candidate overlay region. If no candidate overlay region with an overlapping area greater than the preset area threshold is determined after all historical OSD overlay regions have been traversed, then the preset area threshold is reduced.
[0084] If, based on the first sorting result, a candidate overlay region with an overlapping area greater than a preset area threshold is determined from the overlapping area of any historical OSD overlay region and each candidate overlay region, then that candidate overlay region is taken as the target overlay region; if, based on the overlapping area of any historical overlay region and each candidate overlay region, at least two candidate overlay regions with overlapping areas greater than a preset area threshold are determined, then the candidate overlay region with the largest overlapping area among the at least two candidate overlay regions is taken as the target overlay region.
[0085] The longer the duration of historical OSD overlay regions, the lower the probability of the detected target and dynamic background appearing in those regions. In other words, the more stable the OSD overlay region is. Therefore, the target overlay region should be determined based on the duration of historical OSD overlay regions to make the determined target overlay region more stable and reduce the probability of subsequent jumps.
[0086] Since the detection range covered by the camera equipment acquiring the target video is fixed, even gimbal cameras only periodically rotate to acquire target video within a fixed scene. This results in certain patterns in the captured scene changes. By sorting the overlay duration corresponding to historical OSD overlay areas, we can statistically identify areas within the camera's field of view where key information does not frequently appear. Based on the order of overlay duration corresponding to historical OSD overlay areas from longest to shortest, we can find the target OSD overlay area with the best overlap area among the corresponding candidate overlay areas. By using historical OSD overlay information, we can maximize the stability of the current and subsequent OSD presentation, avoiding frequent large jumps in OSD overlay areas that could cause visual fatigue.
[0087] In a feasible embodiment, after determining the overlap area of each historical OSD overlay area and each candidate overlay area according to the first sorting result and based on the location information of each historical OSD overlay area and the location information of the candidate overlay areas, the method further includes:
[0088] If the overlapping area of all historical OSD overlay areas and each candidate overlay area is less than or equal to the preset area threshold, then according to the first sorting result, based on the location information of each historical OSD overlay area and the location information of each candidate overlay area, the first distance parameter between each historical OSD overlay area and each candidate overlay area is determined in sequence, and the first distance parameter is used as the influence parameter.
[0089] Based on the determination order of the first distance parameter, if the first distance parameter between any candidate overlay area and the historical OSD overlay area is less than the first preset distance threshold, then the candidate overlay area is determined to be the target overlay area.
[0090] The first distance parameter between the historical OSD overlay area and the candidate overlay area is determined based on the distance between the upper left corner coordinates of the historical OSD overlay area and the upper left corner coordinates of the candidate overlay area, or based on the distance between the center point coordinates of the historical OSD overlay area and the center point coordinates of the candidate overlay area.
[0091] Based on the above embodiments, if no candidate overlay area with an overlapping area greater than the preset area threshold is determined after traversing all historical OSD overlay areas, the target overlay area is determined from another perspective of the influencing parameters to ensure the accuracy of the target overlay area determination and avoid the fluctuations caused by reducing the preset area threshold for determination.
[0092] To improve the stability of the target overlay area and avoid frequent fluctuations, the target overlay area is further determined from the candidate overlay areas based on the distance parameter between the target overlay area and the historical OSD overlay area.
[0093] Specifically, according to the order of historical OSD overlay regions in the first sorting result, the first distance parameter between the first historical OSD overlay region (i.e., the historical OSD overlay region with the longest overlay duration) and each candidate overlay region is determined. If the first distance parameter between all candidate overlay regions and the historical OSD overlay region with the longest overlay duration is greater than or equal to the first preset distance threshold, then the next historical OSD overlay region (i.e., the historical OSD overlay region with the second longest overlay duration) and each candidate overlay region is determined according to the first sorting result. If no candidate overlay region with a first distance parameter less than the first distance threshold is determined after all historical OSD overlay regions have been traversed, then the first distance threshold is increased.
[0094] If, based on the first sorting result, a candidate overlay region with a first distance parameter less than a first distance threshold is determined from any historical OSD overlay region and each candidate overlay region, then that candidate overlay region is taken as the target overlay region; if, based on the first sorting result, at least two candidate overlay regions with a first distance parameter less than a first distance threshold are determined from any historical overlay region and each candidate overlay region, then the candidate overlay region with the smallest first distance parameter among those at least two candidate overlay regions is taken as the target overlay region.
[0095] After failing to determine the target overlay region based on the overlapping area between the historical OSD overlay region and the candidate overlay region, the target overlay region is further determined based on the distance parameter between the historical OSD overlay region and the candidate overlay region. This ensures the stability of the target overlay region determination and reduces the probability of long-distance jumps in the subsequent overlay region of the target frame.
[0096] The technical solution of this invention determines the order of historical OSD overlay regions by overlay duration, determines the influence parameters of each historical OSD overlay region on each candidate overlay region based on the order, and determines the target overlay region based on the influence parameters. This improves the correlation between the target overlay region and historical OSD overlay regions with long overlay duration. Since the position of historical OSD overlay regions with longer overlay duration is more stable, the stability of the target overlay region is improved, avoiding frequent long-distance jumps in OSD overlay position on subsequent frames.
[0097] Figure 5 This is a flowchart of another OSD overlay method provided by an embodiment of the present invention. This embodiment further refines the historical OSD overlay information in the above embodiment and further refines the determination of the set of overlayable positions. The historical OSD overlay information also includes the position information of the preceding historical OSD overlay area in the first preceding preset number of frames of the target frame.
[0098] The first pre-set number of frames refers to the preceding frames that are located before the target frame and have OSD overlay information. The number of frames in the first pre-set number of frames can be determined according to the actual situation, such as the adjustment ability of the human eye. For example, the first ten frames of the target frame are the first pre-set number of frames.
[0099] like Figure 5 As shown, the method includes:
[0100] S510. Detect the target and dynamic background in the target frame of the target video to obtain the first detection result, and obtain the detection results of the target and dynamic background in the second preset number of preceding frames of the target frame as historical detection results.
[0101] S520. Determine the motion prediction results of the detection target and dynamic background based on the first detection result and the historical detection results.
[0102] S530. Determine the non-overlapping regions in the target frame based on the first detection result and motion prediction result, and determine the set of overlapping positions in the target frame based on the non-overlapping regions in the target frame.
[0103] S540. Determine at least two candidate overlay regions from the set of overlayable locations based on the target overlay content.
[0104] Optional, the S540 includes:
[0105] Determine the size parameters of the first overlay region based on the target overlay content;
[0106] Candidate overlay regions are determined from the set of overlayable locations based on the size parameters of the first overlay region;
[0107] If the number of candidate overlay regions is 0, the size parameter of the first overlay region is reduced, and candidate overlay regions are determined from the set of overlayable positions based on the reduced size parameter, until the number of candidate overlay regions is greater than 0, or the minimum size parameter of the overlay region is reached and the reduction of the size parameter of the overlay region is stopped.
[0108] The optimal overlay region size parameter is determined based on the target overlay content, serving as the first overlay region size parameter. Alternatively, the first overlay region size parameter can be determined based on the target overlay content and the resolution constraints of the target video. The first overlay region size parameter can be determined according to the actual scene, representing the maximum overlay region size parameter that meets the conditions in the current scene. For example, the first overlay region size parameter can be the pixel information of the region's length and width.
[0109] Based on the size parameter of the first overlay region, the set of overlayable positions is traversed to determine the candidate overlay regions that meet the size requirements. The candidate overlay regions include the position information of the candidate overlay regions, which may include the position information of the upper left corner of the region or the position information of the center point.
[0110] Specifically, if a candidate overlay region matching the first overlay region size parameter is not found during the traversal of the set of overlayable locations, the first overlay region size parameter is reduced to obtain a second overlay region size parameter. The traversal continues using this second overlay region size parameter. If at least one candidate overlay region is still not determined, the overlay region size parameter is further reduced until it reaches the minimum overlay region size parameter. If no candidate overlay region is found, the candidate overlay region with the largest overlapping area with the set of overlayable locations is determined based on this minimum overlay region size parameter. If a candidate overlay region is determined based on any overlay region size parameter, the target overlay region is determined based on the location information of that candidate overlay region.
[0111] For example, multiple OSD font size levels are predetermined, and multiple overlay area size parameters are determined sequentially based on the target overlay content and the multiple OSD font sizes, where the largest overlay area size parameter is the first overlay area size parameter, and the smallest overlay area size parameter is the smallest overlay area size parameter.
[0112] By dynamically adjusting the size parameters of the OSD overlay area, the overlay effect is improved, ensuring that the overlay content is clearly visible while avoiding the OSD overlay content from covering key information on the target frame. S550: Based on the frame interval between each preceding frame and the target frame in the first preset number of preceding frames, the preceding historical OSD overlay areas are sorted in ascending order to obtain the second sorting result of the preceding historical OSD overlay areas.
[0113] The preceding historical OSD overlay regions are sorted in ascending order based on the frame interval, resulting in a second sorting result. In this second sorting result, the preceding historical OSD overlay regions on the preceding frames with smaller frame intervals to the target frame are ranked higher. For example, the preceding historical OSD overlay region on the frame preceding the target frame is ranked first in the second sorting result, the preceding historical OSD overlay region on the two frames preceding the target frame is ranked second, and so on.
[0114] S560. According to the second sorting result, based on the location information of each preceding historical OSD overlay area and the location information of each candidate overlay area, determine the second distance parameter between each preceding historical OSD overlay area and each candidate overlay area in sequence.
[0115] Specifically, according to the order of the preceding historical OSD overlay regions in the second sorting result, the preceding historical OSD overlay region ranked first is first determined, that is, the second distance parameter between the preceding historical OSD overlay region on the previous frame of the target frame and each candidate overlay region. Then, the preceding historical OSD overlay region ranked second is determined, that is, the second distance parameter between the preceding historical OSD overlay region on the two frames before the target frame and each candidate overlay region. The determination is carried out in sequence according to the order of the preceding historical OSD overlay regions in the second sorting result.
[0116] S570. Based on the determination order of the second distance parameter, if the second distance parameter between the location information of any candidate overlay area and the location information of the preceding historical OSD overlay area is less than the second preset distance threshold, then the candidate overlay area is determined to be the target overlay area.
[0117] Specifically, based on the order of the preceding historical OSD overlay regions in the second sorting result, the second distance parameter is determined. If the second distance parameter of all candidate overlay regions and the preceding historical OSD overlay region with the smallest frame interval is greater than or equal to the second preset distance threshold, then the second distance parameter corresponding to the next preceding historical OSD overlay region is determined according to the second sorting result. That is, the second distance parameter between the preceding historical OSD overlay region with the second smallest frame interval and each candidate overlay region is determined. If no candidate overlay region with a second distance parameter less than the second distance threshold is determined after traversing all preceding historical OSD overlay regions, then the historical OSD overlay regions are sorted in descending order according to the overlay duration to obtain the first sorting result of the historical OSD overlay regions. Based on the first sorting result, according to the position information of each historical OSD overlay region and the position information of the candidate overlay regions, the influence parameters of each historical OSD overlay region on each candidate overlay region are determined in sequence, and the target overlay region is determined from the candidate overlay regions according to the influence parameters.
[0118] If, based on the second sorting result, a candidate overlay region with a second distance parameter less than the second distance threshold is determined from any previous historical OSD overlay region and each candidate overlay region, then that candidate overlay region is taken as the target overlay region; if, based on the second sorting result, at least two candidate overlay regions with a second distance parameter less than the second distance threshold are determined from any previous historical overlay region and each candidate overlay region, then the candidate overlay region with the smallest second distance parameter among those at least two candidate overlay regions is taken as the target overlay region.
[0119] The technical solution of this invention determines the order of the preceding historical OSD overlay regions by the frame interval between the target frame and the preceding frame, determines the distance parameters between each preceding historical OSD overlay region and each candidate overlay region based on the order, and determines the target overlay region according to the distance parameters. This reduces the distance between the target overlay region and the preceding historical OSD overlay region of the preceding frame, avoids long-distance jumps between the target overlay region and the preceding historical OSD overlay region on the preceding frame, and thus improves the stability of the target overlay region.
[0120] Figure 6 This is a schematic diagram of an OSD overlay device provided in an embodiment of the present invention. Figure 6 As shown, the device includes:
[0121] The detection result determination module 610 is used to detect the target and dynamic background in the target frame of the target video to obtain a first detection result, and to obtain the detection results of the target and dynamic background in the second preset number of frames preceding the target frame as historical detection results.
[0122] The motion prediction module 620 is used to determine the motion prediction result of the detected target and the dynamic background based on the first detection result and the historical detection result;
[0123] The superimposable position determination module 630 is used to determine the non-superimposable region in the target frame based on the first detection result and the motion prediction result, and to determine the superimposable position set in the target frame based on the non-superimposable region in the target frame;
[0124] The target overlay position determination module 640 is used to determine the target overlay area from the set of overlayable positions based on the target overlay content in the target frame.
[0125] The technical solution of this invention determines the motion prediction results of the detection target and the dynamic background by analyzing the current and historical detection results of the detection target and the dynamic background, and determines the non-overlay area by combining the current detection results and the motion prediction results, thereby dynamically adjusting the OSD overlay position to avoid covering key information on the detection target and the dynamic background that are in motion.
[0126] Optionally, the superimposed location determination module includes a non-superimposed region determination unit, specifically used for:
[0127] Based on the motion prediction results, the predicted position information of the detected target and the dynamic background within a preset time period after the target frame is determined;
[0128] The location information of the detected target and the dynamic background in the first detection result, as well as the predicted location information within a preset time period after the target frame, are taken as the non-overlapping region in the target frame.
[0129] Optionally, the target overlay position determination module includes a target overlay position determination submodule, used for:
[0130] Based on the historical OSD overlay information of the target video and the target overlay content in the target frame, the target overlay region is determined from the set of overlayable locations.
[0131] Optionally, the historical OSD overlay information includes at least the location information of all historical OSD overlay areas and the overlay duration;
[0132] Correspondingly, the target overlay position determination submodule includes:
[0133] The candidate overlay region determination unit is used to determine at least two candidate overlay regions from the set of overlayable positions based on the target overlay content;
[0134] The first sorting unit is used to sort the historical OSD overlay area in descending order according to the overlay duration to obtain the first sorting result of the historical OSD overlay area.
[0135] The first target location determination unit is used to determine the influence parameters of each historical OSD overlay area on each candidate overlay area based on the first sorting result, according to the location information of each historical OSD overlay area and the location information of the candidate overlay area, and determine the target overlay area from the candidate overlay area according to the influence parameters.
[0136] Optionally, the first target location determination unit is specifically used for:
[0137] According to the first sorting result, based on the location information of each historical OSD overlay area and the location information of the candidate overlay area, the overlapping area of each historical OSD overlay area and each candidate overlay area is determined in sequence, and the overlapping area is used as an influence parameter.
[0138] Based on the order of determining the overlapping area, if the overlapping area between any candidate overlay area and the historical OSD overlay area is greater than a preset area threshold, then the candidate overlay area is determined as the target overlay area.
[0139] Optionally, the device further includes a second target location determination unit, used for:
[0140] After determining the overlap area between each historical OSD overlay area and each candidate overlay area according to the first sorting result and based on the location information of each historical OSD overlay area and the location information of the candidate overlay areas:
[0141] If the overlapping area of all historical OSD overlay areas and each candidate overlay area is less than or equal to a preset area threshold, then according to the first sorting result, based on the location information of each historical OSD overlay area and the location information of the candidate overlay area, the first distance parameter between each historical OSD overlay area and each candidate overlay area is determined in sequence, and the first distance parameter is used as an influence parameter.
[0142] Based on the determination order of the first distance parameter, if the first distance parameter between any candidate overlay region and the historical OSD overlay region is less than the first preset distance threshold, then the candidate overlay region is determined to be the target overlay region.
[0143] Optionally, the historical OSD overlay information may also include the location information of the preceding historical OSD overlay area in the first preset number of preceding frames of the target frame;
[0144] Accordingly, the device also includes a third target location determination unit, used before the target overlay location determination module further includes a third target location determination unit, used to sort the historical OSD overlay areas in descending order according to the overlay duration to obtain a first sorting result of the historical OSD overlay areas:
[0145] Based on the frame interval between each preceding frame in the first preset number of preceding frames and the target frame, the preceding historical OSD overlay area is sorted in ascending order to obtain a second sorting result of the preceding historical OSD overlay area.
[0146] According to the second sorting result, based on the location information of each preceding historical OSD overlay area and the location information of the candidate overlay area, the second distance parameter between each preceding historical OSD overlay area and each candidate overlay area is determined sequentially.
[0147] Based on the determination order of the second distance parameter, if the second distance parameter between the location information of any candidate overlay area and the location information of the preceding historical OSD overlay area is less than the second preset distance threshold, then the candidate overlay area is determined to be the target overlay area.
[0148] Optionally, candidate overlay region determination unit, specifically used for
[0149] Determine the size parameters of the first overlay region based on the target overlay content;
[0150] Candidate overlay regions are determined from the set of overlayable locations based on the size parameters of the first overlay region;
[0151] If the number of candidate superimposed regions is 0, the size parameter of the first superimposed region is reduced, and candidate superimposed regions are determined from the set of superimposed positions based on the reduced superimposed region size parameter until the number of candidate superimposed regions is greater than 0, or the minimum superimposed region size parameter is reached and the reduction of the superimposed region size parameter is stopped.
[0152] The OSD overlay device provided in this embodiment of the invention can execute the OSD overlay method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0153] The acquisition, storage, use, and processing of data in this application comply with relevant national laws and regulations and do not violate public order and good morals.
[0154] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0155] Figure 7 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0156] like Figure 7 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0157] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0158] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the OSD overlay method.
[0159] In some embodiments, the OSD overlay method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the OSD overlay method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the OSD overlay method by any other suitable means (e.g., by means of firmware).
[0160] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific reference products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.
[0161] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0162] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0163] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0164] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as data servers), or computing systems that include switching components (e.g., application servers), or computing systems that include front-end components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such back-end, switching, or front-end components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0165] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0166] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0167] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An OSD overlay method, characterized in that, The method includes: The target and dynamic background in the target frame of the target video are detected to obtain a first detection result, and the detection results of the target and dynamic background in the second preset number of frames preceding the target frame are obtained as historical detection results. Based on the first detection result and the historical detection results, determine the motion prediction results of the detection target and the dynamic background; Based on the first detection result and the motion prediction result, the non-overlapping region in the target frame is determined, and based on the non-overlapping region in the target frame, the set of overlapping positions in the target frame is determined; Based on the target overlay content in the target frame, the target overlay area is determined from the set of overlayable positions.
2. The method according to claim 1, characterized in that, Determining the non-overlayable regions in the target frame based on the first detection result and the motion prediction result includes: Based on the motion prediction results, the predicted position information of the detected target and the dynamic background within a preset time period after the target frame is determined; The location information of the detected target and the dynamic background in the first detection result, as well as the predicted location information within a preset time period after the target frame, are taken as the non-overlapping region in the target frame.
3. The method according to claim 1, characterized in that, Based on the target overlay content in the target frame, the target overlay region is determined from the set of overlayable positions, including: Based on the historical OSD overlay information of the target video and the target overlay content in the target frame, the target overlay region is determined from the set of overlayable locations.
4. The method according to claim 3, characterized in that, The historical OSD overlay information includes at least the location information of all historical OSD overlay areas and the duration of the overlay; Accordingly, based on the historical OSD overlay information of the target video and the target overlay content in the target frame, the target overlay region is determined from the set of overlayable locations, including: Based on the target overlay content, at least two candidate overlay regions are determined from the set of overlayable locations; The historical OSD overlay areas are sorted in descending order according to the overlay duration to obtain the first sorting result of the historical OSD overlay areas. Based on the first sorting result, according to the location information of each historical OSD overlay area and the location information of the candidate overlay area, the influence parameters of each historical OSD overlay area on each candidate overlay area are determined in sequence, and the target overlay area is determined from the candidate overlay area according to the influence parameters.
5. The method according to claim 4, characterized in that, Based on the first sorting result, according to the location information of each historical OSD overlay area and the location information of the candidate overlay areas, the influence parameters of each historical OSD overlay area on each candidate overlay area are determined sequentially, and the target overlay area is determined from the candidate overlay areas according to the influence parameters, including: According to the first sorting result, based on the location information of each historical OSD overlay area and the location information of the candidate overlay area, the overlapping area of each historical OSD overlay area and each candidate overlay area is determined in sequence, and the overlapping area is used as an influence parameter. Based on the order of determining the overlapping area, if the overlapping area between any candidate overlay area and the historical OSD overlay area is greater than a preset area threshold, then the candidate overlay area is determined as the target overlay area.
6. The method according to claim 5, characterized in that, After determining the overlap area between each historical OSD overlay area and each candidate overlay area according to the first sorting result, based on the location information of each historical OSD overlay area and the location information of the candidate overlay areas, the method further includes: If the overlapping area of all historical OSD overlay areas and each candidate overlay area is less than or equal to a preset area threshold, then according to the first sorting result, based on the location information of each historical OSD overlay area and the location information of the candidate overlay area, the first distance parameter between each historical OSD overlay area and each candidate overlay area is determined in sequence, and the first distance parameter is used as an influence parameter. Based on the determination order of the first distance parameter, if the first distance parameter between any candidate overlay region and the historical OSD overlay region is less than the first preset distance threshold, then the candidate overlay region is determined to be the target overlay region.
7. The method according to any one of claims 4-6, characterized in that, The historical OSD overlay information also includes the location information of the preceding historical OSD overlay area in the first preset number of preceding frames of the target frame; Accordingly, before sorting the historical OSD overlay areas in descending order according to the overlay duration to obtain the first sorting result of the historical OSD overlay areas, the method further includes: Based on the frame interval between each preceding frame in the first preset number of preceding frames and the target frame, the preceding historical OSD overlay area is sorted in ascending order to obtain a second sorting result of the preceding historical OSD overlay area. According to the second sorting result, based on the location information of each preceding historical OSD overlay area and the location information of the candidate overlay area, the second distance parameter between each preceding historical OSD overlay area and each candidate overlay area is determined sequentially. Based on the determination order of the second distance parameter, if the second distance parameter between the location information of any candidate overlay area and the location information of the preceding historical OSD overlay area is less than the second preset distance threshold, then the candidate overlay area is determined to be the target overlay area.
8. An OSD overlay device, characterized in that, The device includes: The detection result determination module is used to detect the target and dynamic background in the target frame of the target video to obtain a first detection result, and to obtain the detection results of the target and dynamic background in a second preset number of preceding frames of the target frame as historical detection results. The motion prediction module is used to determine the motion prediction result of the detected target and the dynamic background based on the first detection result and the historical detection result; The superimposable position determination module is used to determine the non-superimposable region in the target frame based on the first detection result and the motion prediction result, and to determine the superimposable position set in the target frame based on the non-superimposable region in the target frame; The target overlay position determination module is used to determine the target overlay area from the set of overlayable positions based on the target overlay content in the target frame.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the OSD overlay method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the OSD overlay method according to any one of claims 1-7.