Gradient lens recognition method and device, electronic device and storage medium
By obtaining the threshold of the feature distance and coefficient product of the video frame sequence, it is judged whether the video frame sequence contains a gradient lens, which solves the problem of low accuracy of gradient lens recognition in the existing technology and achieves more accurate gradient lens recognition.
Patent Information
- Application Number
- CN202111452417.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-01
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-12-01
AI Technical Summary
The existing technology has a low accuracy when identifying gradient lenses, and cannot accurately detect gradient lenses with fade-in and fade-out characteristics. This is because the distance between the feature vectors of the preceding and following frames is small, resulting in inaccurate lens detection.
By obtaining the first feature distance between the start frame and the end frame of the target video frame sequence, and when the distance is greater than the preset threshold, the feature distance of any two video frames is obtained, and the second feature distance is smaller than the first feature distance. The threshold multiplied by the coefficient to determine whether to include gradient lenses.
The recognition accuracy of the gradient lens is improved, and the gradient lens can be quickly recognized, thus solving the problem of low recognition accuracy in the existing technology.
Smart Images

Figure CN114187545B
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing, and in particular to a method and device for identifying a gradient lens, an electronic device, and a storage medium. Background Art
[0002] Many movies, long videos and other image videos contain two images that fade in and out to achieve shot transitions. This type of shot is called a gradient shot.
[0003] In order to accurately detect these gradual shots at the frame level, the related technology calculates the feature vector distance between two adjacent frames and pre-sets a distance threshold to determine whether a shot change has occurred here. The larger the feature vector distance, the greater the difference between the two pictures. The greater the difference, the two different pictures should belong to two different shots, so as to perform shot segmentation.
[0004] However, when calculating the feature vector distance between two adjacent frames to determine whether a lens change has occurred in the frame, it is not possible to accurately detect a gradual lens with fade-in and fade-out characteristics. Because the feature vector distance between the frames before and after the change in a gradual lens is small, the image difference is not obvious, so when using the lens detection method of the related technology to identify a gradual lens, the accuracy is low. Summary of the invention
[0005] The present application provides a method and device for recognizing a gradient lens, an electronic device, and a storage medium, so as to at least solve the problem of low accuracy of gradient lens recognition in the related art.
[0006] According to one aspect of an embodiment of the present application, a method for identifying a gradient lens is provided, the method comprising:
[0007] Acquire a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence consisting of a plurality of video frames corresponding to a fixed preset duration;
[0008] If the first feature distance is indeed greater than a first preset threshold, obtaining any two video frames in the target video frame sequence, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the target video frame sequence in pairs, and the distance between the two video frames in the target video frame sequence is less than a preset value;
[0009] Determine a second characteristic distance between the two video frames, and when the second characteristic distance is less than a second preset threshold, determine that the target video frame sequence contains a gradient shot, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance.
[0010] According to another aspect of the embodiment of the present application, a device for identifying a gradient lens is also provided, the device comprising:
[0011] A first acquisition unit is used to acquire a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence composed of a plurality of video frames corresponding to a fixed preset time length;
[0012] A second acquisition unit is used to acquire any two video frames in the target video frame sequence when the first feature distance is greater than a first preset threshold, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the target video frame sequence in pairs, and the distance between the two video frames in the target video frame sequence is less than a preset value;
[0013] A determination unit is used to determine a second characteristic distance between the two video frames, and when the second characteristic distance is less than a second preset threshold, determine that the target video frame sequence contains a gradient shot, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance.
[0014] Optionally, the second acquisition unit includes: a first acquisition module, configured to acquire the two adjacent video frames in the target video frame sequence.
[0015] Optionally, the device further comprises:
[0016] A comparison unit is used to, after determining the second characteristic distance between the two video frames, compare the second characteristic distance with the first characteristic distance in numerical value when it is determined that the second characteristic distance is the maximum value of the characteristic distances between any two video frames in the target video frame sequence.
[0017] Optionally, the second acquisition unit determines the first preset threshold in the following manner:
[0018] A second acquisition module is used to acquire a plurality of third characteristic distances calculated by combining each video frame in a plurality of target video frame sequences in pairs;
[0019] The obtaining module is used to average the multiple third feature distances to obtain the first preset threshold.
[0020] Optionally, the module includes:
[0021] An acquisition subunit, configured to acquire a second preset coefficient, wherein the second preset coefficient is used to represent the weight of the change shot contained in the target video frame sequence;
[0022] A determination subunit is used to determine the product of the mean value and the second preset coefficient as the first preset threshold.
[0023] Optionally, the device further comprises:
[0024] a setting unit, configured to, after determining that a gradual change shot is included in the target video frame sequence, use a starting video frame corresponding to the second characteristic distance as a starting video frame of the gradual change shot, and use an ending video frame corresponding to the second characteristic distance as an ending video frame of the gradual change shot;
[0025] The marking unit is used to obtain the position information of the end video frame of the gradual shot in the target video frame sequence, and mark the position information to obtain a positioning mark.
[0026] Optionally, the device further comprises:
[0027] A third acquisition unit is used to acquire a location mark of the end video frame of the gradual shot in the target video frame sequence;
[0028] The splitting unit is used to split the target video frame sequence based on the positioning identifier to obtain multiple video materials.
[0029] Optionally, the device further comprises:
[0030] A fourth acquisition unit, configured to acquire a target time point corresponding to the end video frame of the gradual shot in the target video frame sequence;
[0031] A display unit is used to display the advertisement content corresponding to the target time point when the video frame in the target video frame sequence is played to the target time point based on the mapping relationship between the target time point and the advertisement content.
[0032] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.
[0033] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.
[0034] In an embodiment of the present application, a first characteristic distance between a start frame and an end frame of a target video frame sequence is obtained, wherein the target video frame sequence is a video frame sequence composed of multiple video frames corresponding to a fixed preset duration; when the first characteristic distance is indeed greater than a first preset threshold, any two video frames in the target video frame sequence are obtained, wherein the first preset threshold is obtained by calculating the characteristic distance by combining each of the multiple target video frame sequences in pairs, and the spacing between the two video frames in the target video frame sequence is less than a preset value; a second characteristic distance between the two video frames is determined, and when the second characteristic distance is less than the second preset threshold, it is determined that the target video frame sequence contains a gradient lens, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance. Since the embodiment of the present application first determines whether there is a shot change in the target video frame sequence based on a comparison between the characteristic distance between the start and end frames of a target video frame sequence and a first preset threshold, and when it is determined that a shot change has occurred, the characteristic distance between any two frames of the target video frame sequence is obtained and compared with the second preset threshold, and then it is determined whether the target video frame contains a gradual shot based on the characteristics of the distance value, thereby achieving the purpose of quickly identifying gradual shots, thereby solving the problem of low accuracy in gradual shot recognition in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0037] Figure 1 is a schematic diagram of a hardware environment of an optional method for identifying a gradient lens according to an embodiment of the present invention;
[0038] Figure 2 is a flow chart of an optional method for identifying a gradient lens according to an embodiment of the present application;
[0039] Figure 3is a schematic diagram of the overall process of an optional method for identifying a gradient lens according to an embodiment of the present application;
[0040] Figure 4 is a structural block diagram of an optional device for identifying a gradient lens according to an embodiment of the present application;
[0041] Figure 5 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0043] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0044] According to one aspect of an embodiment of the present application, a method for identifying a gradient lens is provided. Optionally, in this embodiment, the method for identifying a gradient lens can be applied to Figure 1 In the hardware environment shown in the figure. Figure 1 As shown, the terminal 102 may include a memory 104, a processor 106, and a display 108 (optional component). The terminal 102 may be connected to a server 112 via a network 110 for communication. The server 112 may be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database 114 may be set on the server 112 or independently of the server 112 to provide data storage services for the server 112. In addition, a processing engine 116 may be running in the server 112, and the processing engine 116 may be used to execute the steps executed by the server 112.
[0045] Optionally, the terminal 102 may be, but is not limited to, a terminal that can calculate data, such as a mobile terminal (e.g., a mobile phone, a tablet computer), a laptop, a PC (Personal Computer), etc. The above network may include, but is not limited to, a wireless network or a wired network. The wireless network includes: Bluetooth, WIFI (Wireless Fidelity) and other networks that implement wireless communication. The above wired network may include, but is not limited to: a wide area network, a metropolitan area network, and a local area network. The above server 112 may include, but is not limited to, any hardware device that can perform calculations.
[0046] In addition, in this embodiment, the above-mentioned method for identifying a gradient lens can also be applied to, but not limited to, an independent processing device with a relatively powerful processing capability, without the need for data interaction. For example, the processing device can be, but not limited to, a terminal device with a relatively powerful processing capability, that is, each operation in the above-mentioned method for identifying a gradient lens can be integrated into an independent processing device. The above is only an example, and this embodiment does not impose any limitation on this.
[0047] Optionally, in this embodiment, the above-mentioned method for identifying a gradient lens may be executed by the server 112, or by the terminal 102, or by both the server 112 and the terminal 102. The terminal 102 may execute the method for identifying a gradient lens of the embodiment of the present application, or the client installed thereon.
[0048] Take running on the server as an example, Figure 2 is a flow chart of an optional method for identifying a gradient lens according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:
[0049] Step S201 : obtaining a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence composed of a plurality of video frames corresponding to a fixed preset duration.
[0050] Optionally, in an embodiment of the present application, a target video frame sequence in a complete video frame is obtained as an object for shot recognition. For example, 2 seconds is taken as a fixed preset duration, and a 2-second video frame sequence is selected. At the same time, the 2-second video frame sequence may contain multiple video frames, that is, multiple video frames constitute the target video frame sequence.
[0051] At this time, the starting frame and the ending frame of the target video frame sequence are selected, and the first feature distance between the starting frame and the ending frame is calculated, wherein the first feature distance is the histogram feature distance. It can be understood that the histogram is used to characterize the brightness of the current frame of the video, and the calculation of the histogram feature distance is also to calculate the brightness value between the two video frames.
[0052] The embodiment of the present application can store the timestamps of all video frames in the target video frame sequence and the histogram features of the video frame corresponding to the current timestamp in seconds, represented by {'video frame 1': [timestamp, frame_feature], ...}, and then calculate the histogram feature distance between the two video frames, D = {d (1,2) , d (k+1,k+2) , …, d (n-1,n)}, where n represents the total number of frames in the target video frame. Calculating the histogram feature distance is well known and will not be described in detail.
[0053] Step S202, when the first feature distance is indeed greater than the first preset threshold, obtain any two video frames in the target video frame sequence, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in multiple target video frame sequences in combination with each other, and the distance between the two video frames in the target video frame sequence is less than the preset value.
[0054] Optionally, the embodiment of the present application sets a first preset threshold in advance, and the first preset threshold can be a value obtained by calculating the average value of all the histogram feature distances after all the video frames in the set D are combined in pairs; or the embodiment of the present application sets a second preset coefficient based on historical experience or the video lens tester himself, and the second preset coefficient is used to characterize the weight of the change lens contained in the target video frame sequence, for example, 0.5, and then the above-mentioned mean value is multiplied by the second preset coefficient 0.5 as the first preset threshold.
[0055] The first characteristic distance obtained above is compared with the first preset threshold value. When it is determined that the first characteristic distance is greater than the first preset threshold value, it is considered that a shot change occurs in the target video frame sequence. At this time, any two video frames in the target video frame sequence are obtained. It should be noted that the spacing between the two video frames in the target video frame sequence should be less than a preset value, such as 3 frames, so that the two obtained video frames will not be too far apart.
[0056] Step S203, determining a second characteristic distance between two video frames, and determining that the target video frame sequence contains a gradient shot when the second characteristic distance is less than a second preset threshold, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance.
[0057] Optionally, after obtaining any two video frames, a histogram feature distance is calculated for the two video frames to obtain a second feature distance, and then the second feature distance is numerically compared with a set second preset threshold.
[0058] Since two video frames are selected in the embodiment of the present application with a distance less than the preset value between each other, the range determined by the first characteristic distance alone will change in magnitude. Therefore, in order to numerically quantify the first characteristic distance, a first preset coefficient can be set to adjust the range determined by the first characteristic distance. For example, the first preset coefficient is set to 0.5, etc. At this time, the product of the first characteristic distance multiplied by the first preset coefficient can be used as the second preset threshold, and then the second characteristic distance and the second preset threshold are compared in numerical value. When it is determined that the second characteristic distance is less than the second preset threshold, it means that the shot between the two video frames is a gradual shot, that is, the target video frame sequence contains a gradual shot.
[0059] In an embodiment of the present application, a first characteristic distance between a start frame and an end frame of a target video frame sequence is obtained, wherein the target video frame sequence is a video frame sequence composed of multiple video frames corresponding to a fixed preset duration; when the first characteristic distance is indeed greater than a first preset threshold, any two video frames in the target video frame sequence are obtained, wherein the first preset threshold is obtained by calculating the characteristic distance by combining each of the multiple target video frame sequences in pairs, and the spacing between the two video frames in the target video frame sequence is less than a preset value; a second characteristic distance between the two video frames is determined, and when the second characteristic distance is less than the second preset threshold, it is determined that the target video frame sequence contains a gradient lens, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance. Since the embodiment of the present application first determines whether there is a shot change in the target video frame sequence based on a comparison between the characteristic distance between the start and end frames of a target video frame sequence and a first preset threshold, and when it is determined that a shot change has occurred, the characteristic distance between any two frames of the target video frame sequence is obtained and compared with the second preset threshold, and then it is determined whether the target video frame contains a gradual shot based on the characteristics of the distance value, thereby achieving the purpose of quickly identifying gradual shots, thereby solving the problem of low accuracy in gradual shot recognition in the related art.
[0060] As an optional embodiment, obtaining any two video frames in the target video frame sequence includes:
[0061] Get two adjacent video frames in the target video frame sequence.
[0062] Optionally, in the embodiment of the present application, the positional relationship between two video frames in the selected target video frame is further restricted, that is, two adjacent video frames in the target video frame sequence are selected as the two video frames finally obtained.
[0063] In the embodiment of the present application, by selecting two adjacent video frames to calculate the second characteristic distance, the specific positions of the two video frames when the lens picture changes are more accurately defined.
[0064] As an optional embodiment, after determining the second characteristic distance between the two video frames, the method further includes:
[0065] When it is determined that the second characteristic distance is the maximum value of the characteristic distances between any two video frames in the target video frame sequence, the second characteristic distance is numerically compared with the first characteristic distance.
[0066] Optionally, in an embodiment of the present application, the maximum value of the feature distance between any two video frames in the target video frame sequence is used as the second feature distance. Preferably, the maximum value of the feature distance calculated between two adjacent video frames in the target video frame sequence is selected as the second feature distance, and then the value of the second feature distance is compared with the value of the first feature distance.
[0067] As an optional embodiment, after determining that the target video frame sequence includes a gradual change shot, the method further includes:
[0068] Using the starting video frame corresponding to the second characteristic distance as the starting video frame of the gradual lens, and using the ending video frame corresponding to the second characteristic distance as the ending video frame of the gradual lens;
[0069] The position information of the end video frame of the gradual shot in the target video frame sequence is obtained, and the position information is marked to obtain a positioning mark.
[0070] Optionally, after determining that the target video frame sequence includes a gradual change shot, the starting video frame corresponding to the second characteristic distance can be used as the starting video frame of the gradual change shot, and the ending video frame corresponding to the second characteristic distance can be used as the ending video frame of the gradual change shot. Based on the above embodiments, the largest element d in the characteristic distance D' between two adjacent video frames can be selected. (i+1,i+2) , then the i+1th frame is the starting video frame of the gradual lens, and the i+2th frame is the ending video frame of the gradual lens.
[0071] Then, the position information of the ending video frame of the gradual lens in the target video frame sequence is obtained, and the position information is marked to obtain a positioning mark, so that the position where the gradual lens picture ends can be directly determined.
[0072] In an embodiment of the present application, after identifying the gradient shot and determining the positioning mark of the end video frame, the video material inventory of each channel can be increased, providing more materials for subsequent video mixing and other operations, and subsequent advertising can also be carried out to improve commercial value.
[0073] As an optional embodiment, the embodiment of the present application further proposes a video segmentation method, which utilizes the method for identifying the gradual change shot in the above embodiments, including:
[0074] Obtaining the location mark of the end video frame of the gradual shot in the target video frame sequence;
[0075] The target video frame sequence is split based on the positioning identifier to obtain multiple video materials.
[0076] Optionally, after obtaining the ending video frame of the gradual shot, such as frame i+2, a positioning mark will be marked at the corresponding position of the target video frame sequence. In this way, after identifying the positioning mark, it can be determined that the current gradual shot has ended. The positioning mark can be used as a reference element for splitting the target video frame sequence, and then the target video frame can be split into multiple video materials.
[0077] In the embodiment of the present application, by utilizing the positioning mark corresponding to the end video frame of the gradual shot, the video material inventory of each channel can be greatly improved, providing more materials for subsequent video mixing and other operations.
[0078] As an optional embodiment, the embodiment of the present application further proposes a method for advertising placement, which utilizes the method for recognizing a gradient lens in the above embodiments, including:
[0079] Obtaining the target time point corresponding to the end video frame of the gradual shot in the target video frame sequence;
[0080] Based on the mapping relationship between the target time point and the advertisement content, when the video frame in the target video frame sequence is played to the target time point, the advertisement content corresponding to the target time point is displayed.
[0081] Optionally, after obtaining the ending video frame of the gradual shot, such as the i+2 frame, the target time point corresponding to the current i+2 frame is obtained, such as 2:00. At this time, the mapping relationship between each time point and the advertising content is stored in the database. The database is searched to find the target time point, and the advertising content corresponding to the target time point is found. When the video frame in the target video frame sequence is played to the target time point, the corresponding advertising content can be directly displayed on the page playing the video.
[0082] In the embodiment of the present application, since the time point of the ending video frame of the gradual shot will be marked in the database, and the mapping between each time point and each advertising content is stored in the database, when the advertisement is subsequently placed, the corresponding advertising content can be played directly according to the current time point, which facilitates the placement of advertisements and also increases certain commercial value.
[0083] As an optional embodiment, Figure 3 , Figure 3 This is a schematic diagram of the overall process of an optional method for identifying a gradient lens according to an embodiment of the present application. The specific process is as follows:
[0084] Get all video frames of the original video;
[0085] Calculate the feature distance D between all two adjacent frames; calculate the feature distance dist between the first frame and the last frame of two adjacent seconds;
[0086] A threshold d' is obtained according to the feature distance D;
[0087] Determine whether dist is greater than d';
[0088] When dist is greater than d', the feature distance D' between two adjacent video frames is calculated frame by frame within two seconds;
[0089] In d (i+1,i+2) When it is the maximum corresponding frame in D', judge d (i+1,i+2) Is it less than d'?
[0090] In determining (i+1,i+2) When it is smaller than d', the lens changes into a gradient lens.
[0091] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0092] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0093] According to another aspect of the embodiments of the present application, a device for identifying a gradient lens for implementing the gradient lens identification method is also provided. Figure 4 is a structural block diagram of an optional device for identifying a gradient lens according to an embodiment of the present application, such as Figure 4 As shown, the device may include:
[0094] A first acquisition unit 401 is used to acquire a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence consisting of a plurality of video frames corresponding to a fixed preset duration;
[0095] The second acquisition unit 402 is connected to the first acquisition unit 401, and is used to acquire any two video frames in the target video frame sequence when the first feature distance is greater than a first preset threshold, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the plurality of target video frame sequences in pairs, and the distance between the two video frames in the target video frame sequence is less than a preset value;
[0096] The determination unit 403 is connected to the second acquisition unit 402, and is used to determine a second characteristic distance between two video frames. When the second characteristic distance is less than a second preset threshold, it is determined that the target video frame sequence contains a gradient shot, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance.
[0097] It should be noted that the first acquisition unit 401 in this embodiment can be used to execute the above step S201, the second acquisition unit 402 in this embodiment can be used to execute the above step S202, and the determination unit 403 in this embodiment can be used to execute the above step S203.
[0098] Through the above-mentioned module, since the embodiment of the present application first determines whether there is a shot change in the target video frame sequence based on the comparison between the characteristic distance between the start and end frames of a target video frame sequence and the first preset threshold, when it is determined that a shot change has occurred, the characteristic distance between any two frames of the target video frame sequence is obtained, and the characteristic distance is compared with the second preset threshold, and then according to the characteristics of the distance value, it is determined whether the target video frame contains a gradual shot, thereby achieving the purpose of quickly identifying the gradual shot, and then solving the problem of low accuracy of gradual shot recognition in the related art.
[0099] As an optional embodiment, the second obtaining unit includes:
[0100] The first acquisition module is used to acquire two adjacent video frames in the target video frame sequence.
[0101] As an optional embodiment, the device further includes:
[0102] The comparison unit is used to compare the second characteristic distance with the first characteristic distance after determining the second characteristic distance between the two video frames and when determining that the second characteristic distance is the maximum value of the characteristic distances between two video frames in the target video frame sequence.
[0103] As an optional embodiment, the second obtaining unit determines the first preset threshold in the following manner:
[0104] A second acquisition module is used to acquire a plurality of third characteristic distances calculated by combining each video frame in a plurality of target video frame sequences in pairs;
[0105] The obtaining module is used to average multiple third characteristic distances to obtain a first preset threshold.
[0106] As an optional embodiment, obtaining the module includes:
[0107] An acquisition subunit is used to acquire a second preset coefficient, wherein the second preset coefficient is used to represent the weight of the change shot contained in the target video frame sequence;
[0108] The determination subunit is used to determine the product of the mean value and the second preset coefficient as the first preset threshold.
[0109] As an optional embodiment, the device further includes:
[0110] A setting unit is used for, after determining that the target video frame sequence includes a gradual change shot, using a starting video frame corresponding to the second characteristic distance as a starting video frame of the gradual change shot, and using an ending video frame corresponding to the second characteristic distance as an ending video frame of the gradual change shot;
[0111] The marking unit is used to obtain the position information of the end video frame of the gradual shot in the target video frame sequence, and mark the position information to obtain a positioning mark.
[0112] As an optional embodiment, the device further includes:
[0113] A third acquisition unit is used to acquire a location mark of the end video frame of the gradual shot in the target video frame sequence;
[0114] The splitting unit is used to split the target video frame sequence based on the positioning identifier to obtain multiple video materials.
[0115] As an optional embodiment, the device further includes:
[0116] A fourth acquisition unit, used to acquire a target time point corresponding to the end video frame of the gradual shot in the target video frame sequence;
[0117] The display unit is used to display the advertising content corresponding to the target time point when the video frame in the target video frame sequence is played to the target time point based on the mapping relationship between the target time point and the advertising content.
[0118] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.
[0119] According to another aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned method for identifying a gradient lens is also provided. The electronic device may be a server, a terminal, or a combination thereof.
[0120] Figure 5 is a structural block diagram of an optional electronic device according to an embodiment of the present application, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 communicate with each other through the communication bus 504, wherein,
[0121] Memory 503, used for storing computer programs;
[0122] The processor 501 is used to execute the computer program stored in the memory 503 to implement the following steps:
[0123] Obtaining a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence consisting of a plurality of video frames corresponding to a fixed preset duration;
[0124] When the first feature distance is greater than the first preset threshold, any two video frames in the target video frame sequence are obtained, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the plurality of target video frame sequences in pairs, and the distance between the two video frames in the target video frame sequence is less than the preset value;
[0125] A second characteristic distance between two video frames is determined. When the second characteristic distance is less than a second preset threshold, it is determined that the target video frame sequence contains a gradient shot, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance.
[0126] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0127] The communication interface is used for communication between the above electronic device and other devices.
[0128] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0129] As an example, Figure 5 As shown, the memory 503 may include, but is not limited to, the first acquisition unit 401, the second acquisition unit 402, and the determination unit 403 in the device for recognizing a gradient lens. In addition, it may also include, but is not limited to, other module units in the device for recognizing a gradient lens, which will not be described in detail in this example.
[0130] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0131] In addition, the electronic device further comprises: a display for displaying the recognition result of the gradient lens.
[0132] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0133] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only. The device for implementing the above-mentioned gradient lens recognition method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 5 It does not limit the structure of the above electronic device. For example, the terminal device may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations shown.
[0134] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.
[0135] According to another aspect of the embodiment of the present application, a storage medium is further provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of the method for identifying a gradient lens.
[0136] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.
[0137] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
[0138] Obtaining a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence consisting of a plurality of video frames corresponding to a fixed preset duration;
[0139] When the first feature distance is greater than the first preset threshold, any two video frames in the target video frame sequence are obtained, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the plurality of target video frame sequences in pairs, and the distance between the two video frames in the target video frame sequence is less than the preset value;
[0140] A second characteristic distance between two video frames is determined. When the second characteristic distance is less than a second preset threshold, it is determined that the target video frame sequence contains a gradient shot, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, and the first preset coefficient is a numerical value for quantitatively adjusting the first characteristic distance.
[0141] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.
[0142] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.
[0143] According to another aspect of the embodiments of the present application, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps of the method for identifying a gradient lens in any one of the above embodiments.
[0144] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0145] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to execute all or part of the steps of the method for identifying a gradient lens in each embodiment of the present application.
[0146] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0147] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0148] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.
[0149] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0150] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for identifying a gradient lens, characterized in that: The method comprises: Acquire a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence consisting of a plurality of video frames corresponding to a fixed preset duration; If the first feature distance is indeed greater than a first preset threshold, obtaining any two video frames in the target video frame sequence, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the target video frame sequence in pairs, and the distance between the two video frames in the target video frame sequence is less than a preset value; Determine a second characteristic distance between the two video frames, and determine that the target video frame sequence includes a gradual change shot when the second characteristic distance is less than a second preset threshold, wherein the second preset threshold is the product of the first characteristic distance and a first preset coefficient, the first preset coefficient is a value for quantizing and adjusting the first characteristic distance, and the second characteristic distance is a maximum value of characteristic distances between two video frames in the target video frame sequence; After determining the second characteristic distance between the two video frames, the method further includes: when determining that the second characteristic distance is the maximum value of the characteristic distances between any two video frames in the target video frame sequence, numerically comparing the second characteristic distance with the first characteristic distance.
2. The method according to claim 1, characterized in that The acquiring any two video frames in the target video frame sequence comprises: The two adjacent video frames in the target video frame sequence are obtained.
3. The method according to claim 1, characterized in that When the first feature distance is indeed greater than the first preset threshold, the first preset threshold is obtained in any two video frames in the target video frame sequence by: After acquiring a plurality of third characteristic distances obtained by combining each video frame in pairs in the plurality of target video frame sequences; The plurality of third characteristic distances are averaged to obtain the first preset threshold.
4. The method according to claim 3, characterized in that The averaging the plurality of third characteristic distances to obtain the first preset threshold comprises: Obtaining a second preset coefficient, wherein the second preset coefficient is used to represent the weight of the change shot contained in the target video frame sequence; A product of the mean value and the second preset coefficient is determined as the first preset threshold.
5. The method according to claim 1, characterized in that After determining that the target video frame sequence includes a gradual change shot, the method further includes: Using the starting video frame corresponding to the second characteristic distance as the starting video frame of the gradual change shot, and using the ending video frame corresponding to the second characteristic distance as the ending video frame of the gradual change shot; The position information of the end video frame of the gradual shot in the target video frame sequence is obtained, and the position information is marked to obtain a positioning mark.
6. A video splitting method, characterized in that: The video segmentation is completed by using the method for recognizing gradual change shots according to any one of claims 1 to 5, the method comprising: Obtaining a location mark of the end video frame of the gradual shot in the target video frame sequence; The target video frame sequence is split based on the positioning identifier to obtain multiple video materials.
7. A method for placing advertisements, characterized in that: Advertisement delivery is completed using the method for recognizing a gradient lens as described in any one of claims 1 to 5, the method comprising: Obtaining a target time point corresponding to the end video frame of the gradual shot in the target video frame sequence; Based on the mapping relationship between the target time point and the advertisement content, when the video frame in the target video frame sequence is played to the target time point, the advertisement content corresponding to the target time point is displayed.
8. A device for identifying a gradient lens, characterized in that: The device comprises: A first acquisition unit is used to acquire a first characteristic distance between a start frame and an end frame of a target video frame sequence, wherein the target video frame sequence is a video frame sequence composed of a plurality of video frames corresponding to a fixed preset time length; A second acquisition unit is used to acquire any two video frames in the target video frame sequence when the first feature distance is greater than a first preset threshold, wherein the first preset threshold is obtained by calculating the feature distance of each video frame in the target video frame sequence in pairs, and the distance between the two video frames in the target video frame sequence is less than a preset value; a determination unit, configured to determine a second characteristic distance between the two video frames, and determine that the target video frame sequence includes a gradual change shot when the second characteristic distance is less than a second preset threshold, wherein the second preset threshold is a product of the first characteristic distance and a first preset coefficient, the first preset coefficient is a value for quantitatively adjusting the first characteristic distance, and the second characteristic distance is a maximum characteristic distance value between two video frames in the target video frame sequence; The device also includes: a comparison unit, which is used to, after determining the second characteristic distance between the two video frames, numerically compare the second characteristic distance with the first characteristic distance when it is determined that the second characteristic distance is the maximum value of the characteristic distances between any two video frames in the target video frame sequence.
9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the method steps of any one of claims 1 to 5 by running the computer program stored in the memory.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method steps described in any one of claims 1 to 5 when executed.
