End-credit Recognition Method, Device, Electronic Device and Storage Medium
By identifying the time difference value and pixel grayscale difference of video transition frames, combined with color space processing, the problem of inaccurate end-of-record video recognition video is solved, and a high-precision and efficient end-of-record recognition method is achieved.
Patent Information
- Application Number
- CN202111272312.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In the prior art, when the human eye recognizes the end of the video, it is impossible to accurately locate the second order when the end of the video, resulting in the end of the video that cannot be completely removed or the normal video content is accidentally removed, and the recognition accuracy and efficiency are low.
By identifying the transition frames in the video, the ratio of the time difference value of the transition frame and the total video time length is calculated, combined with the pixel grayscale difference value and color space analysis, the start and end time of the end-of-credit data are determined, and the recognition accuracy is improved by using preprocessing and threshold judgment methods.
It realizes high-precision recognition and efficient removal of the end of the video, improving the accuracy and efficiency of the end of the video.
Smart Images

Figure CN113920465B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of video detection, and particularly to a method, apparatus, electronic device, and storage medium for end-credit recognition. Background Art
[0002] Currently, video works uploaded by users are often given advertising end-credits by merchants, and the advertising end-credits and the entire video work will form a new video. However, as users who are creators, they do not want their video works to carry advertisements. And for video publishing platforms, they also hope that the video works uploaded by users do not carry the information of advertising end-credits. Based on this, it is necessary to remove the advertising end-credits from the video.
[0003] In related technologies, the end-credit part in the video is recognized by human eyes, and further the end-credit part is cropped and removed. However, human eyes often cannot accurately locate to the second level, which will result in the end-credit part not being completely removed after cropping, or normal video content may be removed. Summary of the Invention
[0004] The present disclosure provides a method, apparatus, electronic device, and storage medium for end-credit recognition to recognize the end-credit part in the video, improve the accuracy of end-credit recognition, and improve the recognition efficiency. The technical solution of the present disclosure is as follows:
[0005] According to the first aspect of the embodiments of the present disclosure, a method for end-credit recognition is provided, including: obtaining video data to be recognized; wherein, the video data to be recognized includes end-credit data; recognizing transition frames in the video data to be recognized; obtaining a first moment of the first transition frame in a continuous plurality of transition frames where the transition frame is located in the video data to be recognized; obtaining a second moment of the last transition frame in the continuous plurality of transition frames where the transition frame is located in the video data to be recognized; in a case where a first time difference between the second moment and the first moment is greater than or equal to a first threshold, calculating a second time difference between the second moment and an end moment of the video data to be recognized; in a case where a ratio of the second time difference to a total duration of the video data to be recognized is less than or equal to a second threshold, determining video data between the first moment and the second moment as the end-credit data.
[0006] In some embodiments, the recognizing transition frames in the video data to be recognized includes: preprocessing the video data to be recognized to generate preprocessed video data; calculating a pixel gray difference between a first video frame in the preprocessed video data and an adjacent previous video frame to obtain a difference image of the first video frame; in a case where the difference image meets a preset condition, determining the first video frame as the transition frame.
[0007] In some embodiments, determining that the first video frame is the transition frame when the difference image meets a preset condition includes: obtaining the number of pixels in the difference image whose pixel gray-scale difference is less than or equal to a third threshold, and obtaining a first pixel ratio by comparing it with the total number of pixels in the difference image; when the first pixel ratio is greater than or equal to a fourth threshold, calculating the number of pixels in the preprocessed video data of the first video frame whose gray-scale value is less than or equal to a fifth threshold, and obtaining a second pixel ratio by comparing it with the total number of pixels in the preprocessed video data of the first video frame, and when the second pixel ratio is greater than or equal to a sixth threshold, determining that the first video frame is the transition frame, and / or converting the first video frame to the HSV color space, extracting the chromaticity values of the chromaticity H channels of each pixel, and calculating the variance of the chromaticity values of all pixels in the first video frame, and when the variance is less than or equal to a seventh threshold, determining that the first video frame is the transition frame.
[0008] In some embodiments, the method further includes: when the second pixel ratio is less than the sixth threshold and the variance is greater than the seventh threshold, determining that the first video frame is not the transition frame.
[0009] In some embodiments, preprocessing the video data to be recognized to generate preprocessed video data includes: converting the image of each video frame in the video data to be recognized into a grayscale image to generate the preprocessed video data.
[0010] In some embodiments, the method further includes: when the ratio of the second time difference to the total duration of the video data to be recognized is greater than a second threshold, determining that the video data between the first moment and the second moment is not the end-credit data.
[0011] According to a second aspect of the embodiments of the present disclosure, a post-credit identification device is provided, including: a data acquisition unit for acquiring video data to be identified, where the video data to be identified includes post-credit data; an identification unit for identifying transition frames in the video data to be identified; a first time acquisition unit for acquiring a first time of the first transition frame in a continuous plurality of transition frames where the transition frame is located in the video data to be identified; a second time acquisition unit for acquiring a second time of the last transition frame in the continuous plurality of transition frames where the transition frame is located in the video data to be identified; a data processing unit for calculating a second time difference between the second time and the end time of the video data to be identified when a first time difference between the second time and the first time is greater than or equal to a first threshold; and a determination unit for determining that video data between the first time and the second time is the post-credit data when a ratio of the second time difference to the total duration of the video data to be identified is less than or equal to a second threshold.
[0012] In some embodiments, the identification unit includes: a preprocessing subunit for preprocessing the video data to be identified to generate preprocessed video data; a differential calculation subunit for calculating a pixel gray-scale difference between a first video frame and an adjacent previous video frame in the preprocessed video data to obtain a differential image of the first video frame; and a determination subunit for determining that the first video frame is the transition frame when the differential image meets a preset condition.
[0013] In some embodiments, the determination subunit includes: a pixel ratio calculation module for obtaining a ratio of the number of pixels with a pixel gray-scale difference less than a third threshold in the differential image to the total number of pixels in the differential image to obtain a first pixel ratio; a first determination module for calculating a second pixel ratio of pixels with a gray-scale value less than a fifth threshold in the preprocessed video data of the first video frame when the first pixel ratio is greater than a fourth threshold, and determining that the first video frame is the transition frame when the second pixel ratio is greater than a sixth threshold, and / or converting the first video frame to the HSV color space, extracting the chroma value of each pixel's chroma H channel, and calculating the variance of the chroma values of all pixels in the first video frame, and determining that the first video frame is the transition frame when the variance is less than a seventh threshold.
[0014] In some embodiments, the determination subunit further includes: a second determination module for determining that the first video frame is not the transition frame when the second pixel ratio is less than or equal to the sixth threshold and the variance is greater than or equal to the seventh threshold.
[0015] In some embodiments, the preprocessing subunit is specifically configured to: convert the image of each video frame in the video data to be recognized into a grayscale image, and generate the preprocessed video data.
[0016] In some embodiments, the determination unit is further configured to determine that the video data between the first moment and the second moment is not the end-credit data when the ratio of the second time difference to the total duration of the video data to be recognized is greater than a second threshold.
[0017] According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein, the processor is configured to execute the instructions to implement the end-credit recognition method as described in the first aspect above.
[0018] According to a fourth aspect of the embodiments of the present disclosure, there is provided a storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the end-credit recognition method as described in the first aspect above.
[0019] According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, including a computer program, where the computer program implements the end-credit recognition method as described in the first aspect above when executed by a processor.
[0020] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:
[0021] By implementing the embodiments of the present disclosure, video data to be recognized is obtained; wherein, the video data to be recognized includes end-credit data; transition frames in the video data to be recognized are identified; a first moment of the first transition frame in a continuous plurality of transition frames where the transition frame is located in the video data to be recognized is obtained; a second moment of the last transition frame in the continuous plurality of transition frames where the transition frame is located in the video data to be recognized is obtained; when a first time difference between the second moment and the first moment is greater than or equal to a first threshold, a second time difference between the second moment and the end moment of the video data to be recognized is calculated; when the ratio of the second time difference to the total duration of the video data to be recognized is less than or equal to a second threshold, the video data between the first moment and the second moment is determined to be end-credit data. Thus, the end-credit data in the video data to be recognized can be accurately identified, and the recognition accuracy and efficiency are relatively high.
[0022] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure, and do not constitute an undue limitation on the present disclosure.
[0024] Figure 1 is a flowchart of an end-credit recognition method proposed according to an exemplary embodiment;
[0025] Figure 2 is a flowchart of the sub-steps of S2 of the end-credit recognition method shown according to an exemplary embodiment;
[0026] Figure 3 is a flowchart of the sub-steps of S23 of the end-credit recognition method shown according to an exemplary embodiment;
[0027] Figure 4 is a structural diagram of an end-credit recognition device shown according to an exemplary embodiment;
[0028] Figure 5 is a structural diagram of another end-credit recognition device shown according to an exemplary embodiment;
[0029] Figure 6 is a structural diagram of yet another end-credit recognition device shown according to an exemplary embodiment;
[0030] Figure 7 is a block diagram of an electronic device shown according to an exemplary embodiment. Detailed implementation manners
[0031] In order to enable those of ordinary skill in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0032] Unless otherwise required by the context, throughout the specification and claims, the term "comprising" is to be construed in an open, inclusive sense, i.e., "including, but not limited to". In the description of the specification, the term "some embodiments" and the like are intended to indicate that specific features, structures, materials, or characteristics related to the embodiment or example are included in at least one embodiment or example of the present disclosure. The above-mentioned schematic representations are not necessarily referring to the same embodiment or example. In addition, the specific features, structures, materials, or characteristics may be included in any one or more embodiments or examples in any appropriate manner.
[0033] It should be noted that the terms "first", "second", etc. in the description, claims and the above-mentioned drawings of the present disclosure are used to distinguish similar objects and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0034] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically defined.
[0035] Regarding the problems raised in the background art, by identifying the end credits part in the video with the human eye and removing the end credits, the human eye recognition cannot accurately locate to the second level, which often results in the incomplete removal of the end credits part in the video, or may also remove normal video content, with poor accuracy and low efficiency in recognizing the end credits.
[0036] Based on this, in the embodiments of the present disclosure, a method, device, electronic device and storage medium for end credits recognition are proposed to recognize the end credits part in the video, improve the accuracy of end credits recognition, and improve the recognition efficiency.
[0037] It should be noted that the end credits recognition method in the embodiments of the present disclosure can be executed by the end credits recognition device in the embodiments of the present disclosure. The end credits recognition device can be implemented in a software and / or hardware manner and can be configured in an electronic device. Among them, the electronic device can install and run the end credits recognition program. Among them, the electronic device can include, but is not limited to, hardware devices such as smart phones and tablet computers with various operating systems.
[0038] Figure 1 is a flowchart of a method for end credits recognition proposed according to an exemplary embodiment. As Figure 1 shown, it includes but is not limited to the following steps: including:
[0039] S1: Obtain the video data to be recognized; among them, the video data to be recognized includes end credits data.
[0040] With the continuous development of Internet technology, resources can be shared on different platforms. In the embodiments of the present disclosure, the video data to be recognized can be video data uploaded by users, or video data crawled from the network, or can also be video data obtained by other means, and the embodiments of the present disclosure do not make specific limitations on this.
[0041] It can be understood that with the continuous development of video technology, a large number of videos are given advertising endings by merchants to meet the purpose of merchants promoting their products through videos. Since the content of the advertising endings set by different merchants is different, the ending advertisements may have different special effects and colors. Thus, the video data to be recognized includes ending data, and the ending data included in different video data to be recognized may be the same or different.
[0042] S2: Identify the transition frames in the video data to be recognized.
[0043] It can be understood that video data is composed of multiple frame images, and the image data of any frame can be obtained from the video data.
[0044] In the embodiments of the present disclosure, the video data to be recognized may include multiple video frame images. The video frame images to be recognized can be obtained, and the video frame image data can be processed to identify the transition frames in the video data to be recognized.
[0045] It can be understood that the video data to be recognized may include one transition frame, or may also include multiple transition frames. The multiple transition frames can be a group of consecutive transition frames, or the multiple transition frames can be multiple groups of consecutive transition frames. The embodiments of the present disclosure do not make specific limitations on this.
[0046] S3: Obtain the first moment of the first transition frame in the consecutive multiple transition frames where the transition frame is located in the video data to be recognized.
[0047] S4: Obtain the second moment of the last transition frame in the consecutive multiple transition frames where the transition frame is located in the video data to be recognized.
[0048] It can be understood that generally, the ending data of the video data to be recognized includes multiple video frames, and the multiple video frames are consecutive, so as to be able to display some information.
[0049] In the embodiments of the present disclosure, by obtaining the first moment of the first transition frame in the consecutive multiple transition frames where the transition frame is located in the video data to be recognized, and the second moment of the last transition frame in the consecutive multiple transition frames where the transition frame is located in the video data to be recognized, the duration of the consecutive multiple transition frames where the transition frame is located in the video data to be recognized can be obtained according to the first moment and the second moment.
[0050] S5: When the first time difference between the second moment and the first moment is greater than or equal to the first threshold, calculate the second time difference between the second moment and the end moment of the video data to be recognized.
[0051] In the embodiments of the present disclosure, the duration of a continuous plurality of transition frames where the transition frame is located in the video data to be recognized can be obtained according to the first moment and the second moment. Specifically, calculate the difference between the second moment and the first moment, i.e., the first time difference, to obtain the duration of the continuous plurality of transition frames where the transition frame is located in the video data to be recognized, which is the first time difference.
[0052] Among them, the first threshold can be 0.5 seconds, 1 second, 2 seconds, etc., and the embodiments of the present disclosure do not make specific limitations on this.
[0053] Exemplarily, when the first threshold is 0.5 s, at this time, the 0.5 s time between the first moment and the second moment in the video data to be recognized is all transition frames. It can be guessed that this part of the video data may be the end part of the video. The first threshold of 0.5 s can identify the video data of the suspected end part from the video data to be recognized, which can increase the accuracy of the recognition result.
[0054] In the embodiments of the present disclosure, after determining the first time difference of the continuous plurality of transition frames where the transition frame is located, further calculate the second time difference between the second moment and the end moment of the video data to be recognized.
[0055] S6: When the ratio of the second time difference to the total duration of the video data to be recognized is less than or equal to the second threshold, determine the video data between the first moment and the second moment as the end credit data.
[0056] In the embodiments of the present disclosure, the second threshold can be 20%, or it can also be 15%, etc. The embodiments of the present disclosure do not make specific limitations on this.
[0057] Exemplarily, when the second threshold is 20%, the ratio of the time difference between the video data of the continuous plurality of transition frames where the transition frame is located and the end of the video data to be recognized to the total duration of the video data to be recognized is 20%. At this time, the video data of the continuous plurality of transition frames where the transition frame is located is close to the end of the video data to be recognized. Further determine that the video data of the continuous plurality of transition frames where the transition frame is located is the end credit data, that is, the video data between the first moment and the second moment is the end credit data.
[0058] By implementing the embodiments of the present disclosure, video data to be recognized is obtained; wherein, the video data to be recognized includes end-credit data; transition frames in the video data to be recognized are recognized; a first moment of the first transition frame in a consecutive plurality of transition frames where the transition frame is located in the video data to be recognized is obtained; a second moment of the last transition frame in the consecutive plurality of transition frames where the transition frame is located in the video data to be recognized is obtained; when a first time difference between the second moment and the first moment is greater than or equal to a first threshold, a second time difference between the second moment and the end moment of the video data to be recognized is calculated; when a ratio of the second time difference to the total duration of the video data to be recognized is less than or equal to a second threshold, the video data between the first moment and the second moment is determined to be end-credit data. Thus, the end-credit data in the video data to be recognized can be accurately recognized, with relatively high recognition accuracy and efficiency.
[0059] In some embodiments, when the ratio of the second time difference to the total duration of the video data to be recognized is greater than the second threshold, it is determined that the video data between the first moment and the second moment is not end-credit data.
[0060] In the embodiments of the present disclosure, when the ratio of the second time difference to the total duration of the video data to be recognized is greater than the second threshold, for example, the ratio of the second time difference to the total duration of the video data to be recognized is 30%, it indicates that the video data of the consecutive plurality of transition frames where the transition frame is located is still relatively far from the end of the video data to be recognized, and there is still a relatively long period of video data after the video data of the consecutive plurality of transition frames where the transition frame is located in the video data to be recognized, which means that the video data of the consecutive plurality of transition frames where the transition frame is located is unlikely to be end-credit data or the probability of it being end-credit data is relatively small.
[0061] Based on this, in the embodiments of the present disclosure, the video data of the consecutive plurality of transition frames in this case is determined not to be end-credit data, further improving the accuracy of recognizing end-credit data.
[0062] In some embodiments, as Figure 2 shown, step S2 in the embodiments of the present disclosure includes but is not limited to the following sub-steps:
[0063] S21: Preprocess the video data to be recognized to generate preprocessed video data.
[0064] Wherein, the video data to be recognized may be data in the RGB color space. In the embodiments of the present disclosure, the video data to be recognized in the RGB color space needs to be preprocessed to obtain preprocessed video data.
[0065] In some embodiments, in the embodiments of the present disclosure, preprocessing the video data to be recognized includes:
[0066] Convert the image of each video frame in the video data to be recognized into a grayscale image to generate preprocessed video data.
[0067] In the embodiments of the present disclosure, the image of each video frame in the video data to be recognized in the RGB color space is converted to the grayscale space, the grayscale image of each video frame image is obtained, and preprocessed video data is generated.
[0068] S22: Calculate the pixel grayscale difference between the first video frame and the adjacent previous video frame in the preprocessed video data to obtain the difference image of the first video frame.
[0069] It can be understood that the image of each video frame in the video data to be recognized in the RGB color space is converted to the grayscale space, the grayscale image of each video frame image is obtained, the grayscale image includes 256 gray levels, and in the grayscale image of each video frame image, each pixel has its gray level value. Calculate the pixel grayscale difference between the first video frame and its adjacent previous video frame, that is, subtract the gray level value of each pixel in the first video frame from the gray level value of the corresponding pixel in its adjacent previous video frame to obtain the difference image corresponding to the first video frame.
[0070] S23: When the difference image meets the preset conditions, determine that the first video frame is a transition frame.
[0071] In the embodiments of the present disclosure, it is possible to determine whether the first video frame is a transition frame according to the difference image corresponding to the first video frame. For example, it is judged whether the difference image corresponding to the first video frame meets the preset conditions, and when the preset conditions are met, it is determined that the first video frame is a transition frame.
[0072] In some embodiments, as Figure 3 shown, in the embodiments of the present disclosure, S23 includes but is not limited to the following sub-steps:
[0073] S231: Obtain the number of pixels in the difference image whose pixel grayscale difference is less than or equal to the third threshold, and compare it with the total number of pixels in the difference image to obtain the first pixel ratio.
[0074] Among them, the third threshold can be 30, 29, 28, 27, 26 or 25, etc., and the embodiments of the present disclosure do not make specific limitations on this.
[0075] It can be understood that in the difference image, the pixel grayscale difference is the difference between the gray level values of two pixels corresponding to two video frames. When the pixel grayscale difference is less than the third threshold, it means that the change of the first video frame displayed by this pixel relative to the previous video frame is not large, and it may be a similar video frame image, and this pixel may be a stationary pixel.
[0076] In an embodiment of the present disclosure, when the third threshold is 30, it can be determined that the change in the first video frame displayed by the pixel relative to the previous video frame is not significant, and the first video frame may be a similar video frame image. The smaller the third threshold that the pixel gray difference is less than, the closer the first video frame displayed by the pixel is to the image displayed by the previous video frame, and even the same content may be displayed, and the pixel may be a stationary pixel.
[0077] It can be understood that the first video frame includes multiple pixels. The pixel gray difference of each pixel is compared with the third threshold, and the number of pixels less than the third threshold is counted. Compared with the total number of pixels in the differential image, the first pixel ratio is obtained.
[0078] S232: When the first pixel ratio is greater than or equal to the fourth threshold, calculate the number of pixels with gray values less than or equal to the fifth threshold in the preprocessed video data of the first video frame. Compared with the total number of pixels in the preprocessed video data of the first video frame, the second pixel ratio is obtained. When the second pixel ratio is greater than or equal to the sixth threshold, determine that the first video frame is a transition frame, and / or convert the first video frame to the HSV color space, extract the chroma values of the chroma H channels of each pixel, and calculate the variance of the chroma values of all pixels in the first video frame. When the variance is less than or equal to the seventh threshold, determine that the first video frame is a transition frame.
[0079] In an embodiment of the present disclosure, the fourth threshold may be 80%, or may also be 85%, or may also be 90%, etc. The present disclosure does not make specific limitations on this.
[0080] It can be understood that when the first pixel ratio is greater than the fourth threshold, it indicates that most pixels of the first video frame are stationary pixels, and it can be determined that the first video frame meets the conditions for judging a transition frame.
[0081] Based on this, in an embodiment of the present disclosure, the following methods can be used: Method 1: Calculate the number of pixels with gray values less than or equal to the fifth threshold in the preprocessed video data of the first video frame. Compared with the total number of pixels in the preprocessed video data of the first video frame, the second pixel ratio is obtained. When the second pixel ratio is greater than or equal to the sixth threshold, determine that the first video frame is a transition frame, and / or Method 2: Convert the first video frame to the HSV color space, extract the chroma values of the chroma H channels of each pixel, and calculate the variance of the chroma values of all pixels in the first video frame. When the variance is less than or equal to the seventh threshold, determine that the first video frame is a transition frame.
[0082] Among them, Method 1: In the method of determining the first video frame as a transition frame when calculating the ratio of the number of pixels with gray values less than or equal to the fifth threshold in the preprocessed video data of the first video frame to the total number of pixels in the preprocessed video data of the first video frame, and obtaining a second pixel ratio, and when the second pixel ratio is greater than or equal to the sixth threshold.
[0083] Calculating the ratio of the number of pixels with gray values less than or equal to the fifth threshold in the preprocessed video data of the first video frame to the total number of pixels in the preprocessed video data of the first video frame to obtain a second pixel ratio can be understood as follows: In the preprocessed video data of the first video frame, each pixel has a gray scale value. When the gray scale value of the pixel is less than or equal to the fifth threshold, the pixel is relatively dark at this time and can be approximated as a "black pixel". After comparing each pixel in the preprocessed video data of the first video frame with the fifth threshold one by one, the number of "black pixels" can be obtained, and then the ratio of the number of "black pixels" to the total number of pixels in the preprocessed video data of the first video frame is calculated to obtain the second pixel ratio.
[0084] Among them, the fifth threshold can be 25, or it can also be 30. The embodiments of the present disclosure do not make specific limitations on this.
[0085] Furthermore, compare the size of the second pixel ratio and the sixth threshold. When the second pixel ratio is greater than or equal to the sixth threshold, determine the first video frame as a transition frame.
[0086] Among them, the sixth threshold can be 80%, or it can also be 85% or the like. The embodiments of the present disclosure do not make specific limitations on this.
[0087] It can be understood that if the second pixel ratio is greater than or equal to the sixth threshold, it means that most of the pixels in the preprocessed video data of the first video frame are "black pixels", so it can be determined that the first video frame is a dark picture and is a transition frame.
[0088] Among them, Method 2: In the method of determining the first video frame as a transition frame when converting the first video frame to the HSV color space, extracting the chromaticity values of the chromaticity H channels of each pixel, and calculating the variance of the chromaticity values of all pixels in the first video frame, and when the variance is less than or equal to the seventh threshold.
[0089] In the embodiments of the present disclosure, the first video frame is in the RGB color space. Convert the first video frame to the HSV color space, extract the chromaticity values of the chromaticity H channels of each pixel, calculate the variance of the chromaticity values of all pixels in the chromaticity H channels of the first video frame, compare it with the seventh threshold, and when the variance is less than or equal to the seventh threshold, determine the first video frame as a transition frame.
[0090] Among them, the seventh threshold can be 25, or it can also be other values. The embodiments of the present disclosure do not make specific limitations on this.
[0091] It can be understood that when the variance is less than or equal to the seventh threshold, that is, less than or equal to 25, it indicates that the pixels of the first video frame tend to be consistent, which means that the hues of the respective pixels of the first video frame are close. In this case, the first video frame with close hues can be recognized.
[0092] In the embodiments of the present disclosure, by converting the first video frame to the HSV color space, extracting the chroma values of the chroma H channels of each pixel, and calculating the variance of the chroma values of all the pixels in the first video frame, when the variance is less than or equal to the seventh threshold, it is determined that the first video frame is a transition frame, which can support the recognition of the end-credit video with any hue, and the range of the recognized end-credit video is larger, making the recognition of the end credits more accurate.
[0093] It should be noted that in the embodiments of the present disclosure, it is also possible to jointly determine whether the first video frame is a transition frame according to both Method 1 and Method 2 in the above examples. In this regard, no further examples will be given in the embodiments of the present disclosure, and the implementation manner can be referred to the description of the above examples and will not be elaborated here.
[0094] In some embodiments, in the embodiments of the present disclosure, when the second pixel ratio is less than the sixth threshold and the variance is greater than the seventh threshold, it is determined that the first video frame is not a transition frame.
[0095] It can be understood that only when the second pixel ratio of the first video frame is less than the sixth threshold and the variance is greater than the seventh threshold, it is determined that the first video frame is not a transition frame, which can improve the accuracy of recognizing the end-credit video.
[0096] Figure 4 is a structural diagram of an end-credit recognition device according to an exemplary embodiment, as Figure 4 shown, including: a data acquisition unit 11, an identification unit 12, a first moment acquisition unit 13, a second moment acquisition unit 14, a data processing unit 15, and a determination unit 16.
[0097] Among them, the data acquisition unit 11 is used to acquire the video data to be recognized; among them, the video data to be recognized includes end-credit data.
[0098] The identification unit 12 is used to identify the transition frames in the video data to be recognized.
[0099] The first moment acquisition unit 13 is used to acquire the first moment of the first transition frame in a continuous plurality of transition frames where the transition frame is located in the video data to be recognized.
[0100] The second moment acquisition unit 14 is used to acquire the second moment of the last transition frame in a continuous plurality of transition frames where the transition frame is located in the video data to be recognized.
[0101] A data processing unit 15, configured to calculate a second time difference between the second moment and the end moment of the video data to be recognized when a first time difference between the second moment and the first moment is greater than or equal to a first threshold.
[0102] A determination unit 16, configured to determine that the video data between the first moment and the second moment is end-credit data when a ratio of the second time difference to the total duration of the video data to be recognized is less than or equal to a second threshold.
[0103] As Figure 5 shown, in some embodiments, in the embodiments of the present disclosure, the recognition unit 12 includes:
[0104] A preprocessing subunit 121, configured to preprocess the video data to be recognized to generate preprocessed video data.
[0105] A differential calculation subunit 122, configured to calculate a pixel gray difference between a first video frame and an adjacent previous video frame in the preprocessed video data to obtain a differential image of the first video frame.
[0106] A determination subunit 123, configured to determine that the first video frame is a transition frame when the differential image meets a preset condition.
[0107] As Figure 6 shown, in some embodiments, in the embodiments of the present disclosure, the determination subunit 123 includes:
[0108] A pixel ratio calculation module 1231, configured to obtain a number of pixels with a pixel gray difference less than a third threshold in the differential image, and compare it with the total number of pixels in the differential image to obtain a first pixel ratio.
[0109] A first determination module 1232, configured to calculate a second pixel ratio of gray values less than a fifth threshold in the preprocessed video data of the first video frame when the first pixel ratio is greater than a fourth threshold, and determine that the first video frame is a transition frame when the second pixel ratio is greater than a sixth threshold, and / or convert the first video frame to the HSV color space, extract the chroma values of the chroma H channels of each pixel, and calculate the variance of the chroma values of all pixels in the first video frame, and determine that the first video frame is a transition frame when the variance is less than a seventh threshold.
[0110] Please continue to refer to Figure 6 , in some embodiments, in the embodiments of the present disclosure, the determination subunit 123 further includes:
[0111] A second determination module 1233, configured to determine that the first video frame is not a transition frame when the second pixel ratio is less than or equal to the sixth threshold and the variance is greater than or equal to the seventh threshold.
[0112] In some embodiments, in the embodiments of the present disclosure, the preprocessing subunit 121 is specifically configured to: convert the image of each video frame in the video data to be recognized into a grayscale image, and generate preprocessed video data.
[0113] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0114] In the end-credit recognition device 10 provided in the embodiments of the present disclosure, the data acquisition unit 11 acquires the video data to be recognized; wherein, the end-credit data is included in the video data to be recognized; the recognition unit 12 recognizes the transition frames in the video data to be recognized; the first moment acquisition unit 13 acquires the first moment of the first transition frame in the continuous multiple transition frames where the transition frame is located in the video data to be recognized; the second moment acquisition unit 14 acquires the second moment of the last transition frame in the continuous multiple transition frames where the transition frame is located in the video data to be recognized; the data processing unit 15 calculates the second time difference between the second moment and the end moment of the video data to be recognized when the first time difference between the second moment and the first moment is greater than or equal to the first threshold; the determination unit 16 determines that the video data between the first moment and the second moment is end-credit data when the ratio of the second time difference to the total duration of the video data to be recognized is less than or equal to the second threshold. Thus, the end-credit data in the video data to be recognized can be accurately recognized, and the recognition accuracy and efficiency are relatively high.
[0115] Figure 7 It is a block diagram of an electronic device 100 for an end-credit recognition method according to an exemplary embodiment.
[0116] Exemplarily, the electronic device 100 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0117] As Figure 7 shown, the electronic device 100 may include one or more of the following components: a processing component 101, a memory 102, a power component 103, a multimedia component 104, an audio component 105, an input / output (I / O) interface 106, a sensor component 107, and a communication component 108.
[0118] The processing component 101 generally controls the overall operation of the electronic device 100, such as operations associated with display, phone call, data communication, camera operation, and recording operation. The processing component 101 may include one or more processors 1011 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 101 may include one or more modules to facilitate the interaction between the processing component 101 and other components. For example, the processing component 101 may include a multimedia module to facilitate the interaction between the multimedia component 104 and the processing component 101.
[0119] The memory 102 is configured to store various types of data to support the operation of the electronic device 100. Examples of such data include instructions for any application or method operating on the electronic device 100, contact data, phone book data, messages, pictures, videos, etc. The memory 102 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as SRAM (Static Random-Access Memory), EEPROM (Electrically Erasable Programmable read only memory), EPROM (Erasable Programmable Read-Only Memory), PROM (Programmable read-only memory), ROM (Read-Only Memory), magnetic memory, flash memory, magnetic disk, or optical disk.
[0120] The power component 103 provides power for various components of the electronic device 100. The power component 103 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 100.
[0121] The multimedia component 104 includes a touch display screen that provides an output interface between the electronic device 100 and the user. In some embodiments, the touch display screen may include an LCD (Liquid Crystal Display) and a TP (Touch Panel). The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 104 includes a front camera and / or a rear camera. When the electronic device 100 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0122] The audio component 105 is configured to output and / or input audio signals. For example, the audio component 105 includes a MIC (Microphone). When the electronic device 100 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive external audio signals. The received audio signals can be further stored in the memory 102 or transmitted via the communication component 108. In some embodiments, the audio component 105 further includes a speaker for outputting audio signals.
[0123] The I / O interface 2112 provides an interface between the processing component 101 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a power button, and a lock button.
[0124] The sensor assembly 107 includes one or more sensors for providing status assessments of various aspects for the electronic device 100. For example, the sensor assembly 107 can detect the on / off state of the electronic device 100, the relative positioning of components, such as the display and keypad of the electronic device 100. The sensor assembly 107 can also detect a change in the position of the electronic device 100 or a component of the electronic device 100, the presence or absence of user contact with the electronic device 100, the orientation or acceleration / deceleration of the electronic device 100, and the temperature change of the electronic device 100. The sensor assembly 107 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 107 can also include a light sensor, such as a CMOS (Complementary Metal Oxide Semiconductor) or CCD (Charge-coupled Device) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 107 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0125] The communication component 108 is configured to facilitate communication between the electronic device 100 and other devices in a wired or wireless manner. The electronic device 100 can access a wireless network based on communication standards, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 108 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 108 further includes an NFC (Near Field Communication) module to facilitate short-range communication. For example, the NFC module can be implemented based on RFID (Radio Frequency Identification) technology, IrDA (Infrared Data Association) technology, UWB (Ultra Wide Band) technology, BT (Bluetooth) technology, and other technologies.
[0126] In an exemplary embodiment, the electronic device 100 may be implemented by one or more ASICs (Application Specific Integrated Circuits), DSPs (Digital Signal Processors), digital signal processing devices (DSPDs), PLDs (Programmable Logic Devices), FPGAs (Field Programmable Gate Arrays), controllers, microcontrollers, microprocessors, or other electronic components, and is used to execute the above-mentioned end-credit recognition method. It should be noted that for the implementation process and technical principle of the electronic device in this embodiment, refer to the foregoing explanation of the end-credit recognition method of the embodiments of the present disclosure, which will not be elaborated here.
[0127] The electronic device provided by the embodiments of the present disclosure can execute the end-credit recognition method as described in some of the above embodiments, and its beneficial effects are the same as those of the above-mentioned end-credit recognition method, which will not be elaborated here.
[0128] To implement the above embodiments, the present disclosure also proposes a storage medium.
[0129] Among them, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the end-credit recognition method as described above. For example, the storage medium may be a ROM (Read Only Memory Image), a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0130] To implement the above embodiments, the present disclosure also provides a computer program product. When the computer program is executed by the processor of the electronic device, the electronic device can execute the end-credit recognition method as described above. Those skilled in the art will readily think of other implementations of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include known common knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.
[0131] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.
Claims
1. A method for end-credit identification, characterized in that, The method includes: Obtaining video data to be recognized; wherein, the video data to be recognized includes end-credit data; Recognizing transition frames in the video data to be recognized; Obtaining a first moment of the first transition frame in a continuous plurality of transition frames where the transition frame is located in the video data to be recognized; Obtaining a second moment of the last transition frame in the continuous plurality of transition frames where the transition frame is located in the video data to be recognized; When a first time difference between the second moment and the first moment is greater than or equal to a first threshold, calculating a second time difference between the second moment and an end moment of the video data to be recognized; When a ratio of the second time difference to a total duration of the video data to be recognized is less than or equal to a second threshold, determining video data between the first moment and the second moment as the end-credit data.
2. The method according to claim 1, characterized in that, The recognizing transition frames in the video data to be recognized includes: Preprocessing the video data to be recognized to generate preprocessed video data; Calculating a pixel gray-level difference between a first video frame in the preprocessed video data and an adjacent previous video frame to obtain a difference image of the first video frame; When the difference image meets a preset condition, determining the first video frame as the transition frame.
3. The method according to claim 2, wherein The when the difference image meets the preset condition and determining the first video frame as the transition frame includes: Obtaining a number of pixels with pixel gray-level differences less than or equal to a third threshold in the difference image, and comparing it with a total number of pixels in the difference image to obtain a first pixel ratio; When the first pixel ratio is greater than or equal to a fourth threshold, calculating a number of pixels with gray-level values less than or equal to a fifth threshold in the preprocessed video data of the first video frame, and comparing it with a total number of pixels in the preprocessed video data of the first video frame to obtain a second pixel ratio. When the second pixel ratio is greater than or equal to a sixth threshold, determining the first video frame as the transition frame, and / or converting the first video frame to an HSV color space, extracting a chroma value of a chroma H channel of each pixel, and calculating a variance of chroma values of all pixels in the first video frame. When the variance is less than or equal to a seventh threshold, determining the first video frame as the transition frame.
4. The method according to claim 3, characterized in that The method further includes: When the second pixel ratio is less than the sixth threshold and the variance is greater than the seventh threshold, determining that the first video frame is not the transition frame.
5. The method according to claim 2, wherein The preprocessing the video data to be recognized to generate preprocessed video data includes: Converting an image of each video frame in the video data to be recognized into a grayscale image to generate the preprocessed video data.
6. The method according to claim 1, characterized in that, The method further includes: When a ratio of the second time difference to the total duration of the video data to be recognized is greater than the second threshold, determining that video data between the first moment and the second moment is not the end-credit data.
7. A device for end-credit identification, characterized in that The apparatus includes: A data acquisition unit for obtaining video data to be recognized; wherein, the video data to be recognized includes end-credit data; An identification unit for identifying transition frames in the video data to be identified; A first moment acquisition unit for acquiring the first moment of the first transition frame among a continuous plurality of transition frames where the transition frame is located in the video data to be identified; A second moment acquisition unit for acquiring the second moment of the last transition frame among a continuous plurality of transition frames where the transition frame is located in the video data to be identified; A data processing unit for calculating a second time difference between the second moment and the end moment of the video data to be identified when a first time difference between the second moment and the first moment is greater than or equal to a first threshold; A determination unit for determining that the video data between the first moment and the second moment is the end-credit data when a ratio of the second time difference to the total duration of the video data to be identified is less than or equal to a second threshold; 8. The device according to claim 7, characterized in that, The identification unit includes: A preprocessing subunit for preprocessing the video data to be identified to generate preprocessed video data; A differential calculation subunit for calculating a pixel gray-scale difference between a first video frame in the preprocessed video data and the adjacent previous video frame to obtain a differential image of the first video frame; A determination subunit for determining that the first video frame is the transition frame when the differential image meets a preset condition; 9. The device according to claim 8, characterized in that, The determination subunit includes: A pixel ratio calculation module for obtaining a number of pixels with a pixel gray-scale difference less than a third threshold in the differential image and comparing it with the total number of pixels in the differential image to obtain a first pixel ratio; A first determination module for calculating a second pixel ratio of gray-scale values less than a fifth threshold in the preprocessed video data of the first video frame when the first pixel ratio is greater than a fourth threshold, and determining that the first video frame is the transition frame when the second pixel ratio is greater than a sixth threshold, and / or converting the first video frame to the HSV color space, extracting the chromaticity values of the chromaticity H channels of each pixel, and calculating the variance of the chromaticity values of all pixels in the first video frame, and determining that the first video frame is the transition frame when the variance is less than a seventh threshold; 10. The device according to claim 9, characterized in that The determination subunit further includes: A second determination module for determining that the first video frame is not the transition frame when the second pixel ratio is less than or equal to the sixth threshold and the variance is greater than or equal to the seventh threshold; 11. The device according to claim 8, characterized in that, The preprocessing subunit is specifically configured to: Convert the image of each video frame in the video data to be identified into a grayscale image to generate the preprocessed video data; 12. The device according to claim 7, wherein, The determination unit is further configured to determine that the video data between the first moment and the second moment is not the end-credit data when a ratio of the second time difference to the total duration of the video data to be identified is greater than the second threshold; 13. An electronic device, characterized in that, It includes: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the method according to any one of claims 1 to 6.
14. A storage medium, characterized in that, When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 6.
15. A computer program product, comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device and system for advertisement statistics
CN102469350A
Method and device for detecting video frame, and electronic equipment
CN108924586A