Similarity judgment method, key frame extraction method and device, medium and equipment

By calculating the intersection ratio parameter of the document image, combined with the preset similarity conditions, the problem in the existing technology of being unable to accurately identify the similarity of different frames in the same document video is solved, and accurate similarity judgment of the document image is achieved, which is suitable for real-time scene.

CN114973293BActive Publication Date: 2024-09-20GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210642081.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2024-09-20
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

It is difficult for the existing technology to accurately identify the document image similarity of different frames in the same document video in real-time scenarios. Especially for video frames with small differences in the same document video, conventional methods often fail to obtain correct judgment results.

Method used

By calculating the intersection and union ratio parameters of the document image, combined with the preset similarity conditions, the similarity of the document images is determined, and the intersection and union ratio parameters are used to characterize the degree of overlap of the images, so as to realize the similarity judgment of the document images.

Benefits of technology

It effectively avoids the problem of being unable to judge the similarity of different frames in the same document video based on design features, improves the accuracy of judging the similarity of document images, and is suitable for real-time scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114973293B
    Figure CN114973293B
Patent Text Reader

Abstract

The present disclosure provides a similarity judgment method, a similarity judgment device, a key frame extraction method, a key frame extraction device, a computer-readable medium and an electronic device, and relates to the field of image processing technology. The method comprises: obtaining a first document image and a second document image; calculating similarity parameters based on the first document image and the second document image, wherein the similarity parameters include intersection-over-union parameters; and determining the similarity between the first document image and the second document image according to the similarity parameters and the corresponding preset similarity conditions. The present disclosure can perform targeted similarity judgment on the document images by calculating the intersection-over-union parameters that characterize the degree of overlap between the first document image and the second document image, thereby avoiding the problem that the document images cannot be judged similarly based on design features.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In the related art, there are two main methods for identifying repeated image frames. One is based on neural networks. Usually, it is necessary to train the neural network through big data. After the training, only two images need to be input to output the similarity judgment result; the other type mainly relies on artificially designed features, such as histograms, to calculate the similarity between two images to judge whether they are similar. However, the first type of method mentioned above is time-consuming, power-intensive, and cannot be applied to scenarios with high real-time requirements. The second type of method is mainly for repeated recognition of conventional images. For video frames with small differences such as document images in different frames in the same document video, correct judgment results are often not obtained. Summary of the invention

[0003] The purpose of the present disclosure is to provide a similarity judgment method, a similarity judgment device, a key frame extraction method, a key frame extraction device, a computer-readable medium and an electronic device, thereby at least to a certain extent avoiding the problem of being unable to perform similarity judgment on document images in different frames in the same document video based on design features.

[0004] According to a first aspect of the present disclosure, a similarity judgment method is provided, comprising: acquiring a first document image and a second document image; calculating similarity parameters based on the first document image and the second document image, the similarity parameters comprising intersection-over-union parameters; and determining the similarity between the first document image and the second document image based on the similarity parameters and corresponding preset similarity conditions.

[0005] According to a second aspect of the present disclosure, a key frame extraction method is provided, comprising: obtaining a current key frame in a video frame sequence corresponding to a video, and performing document key frame extraction processing on the current key frame; wherein the document key frame extraction processing comprises: when the current key frame is a document frame, determining that the current key frame is a document key frame; obtaining a cache sequence corresponding to the video frame sequence, and adding the document key frame to the cache sequence when the cache sequence is an empty sequence; when the cache sequence is a non-empty sequence, obtaining the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame, and using the similarity judgment method provided in the first aspect to determine the similarity between the document key frame and the reference key frame; when the document key frame is not similar to the reference key frame, selecting a target key frame in the cache sequence to add to the key frame sequence, and after clearing the cache sequence, adding the document key frame to the cache sequence; when the document key frame is similar to the reference key frame, adding the document key frame to the cache sequence; obtaining the next key frame in the video frame sequence, and continuing to perform document key frame extraction processing on the next key frame until the video ends and the video frame sequence is empty, and outputting the key frame sequence.

[0006] According to a third aspect of the present disclosure, a similarity judgment device is provided, comprising: an image acquisition module for acquiring a first document image and a second document image; a parameter calculation module for calculating similarity parameters based on the first document image and the second document image, the similarity parameters comprising intersection-over-union parameters; and a similarity judgment module for determining the similarity between the first document image and the second document image based on the similarity parameters and corresponding preset similarity conditions.

[0007] According to a fourth aspect of the present disclosure, a key frame extraction device is provided, comprising: a first processing module, configured to obtain a current key frame in a video frame sequence corresponding to a video, and perform document key frame extraction processing on the current key frame; wherein the document key frame extraction processing comprises: when the current key frame is a document frame, determining that the current key frame is a document key frame; obtaining a cache sequence corresponding to the video frame sequence, and adding the document key frame to the cache sequence when the cache sequence is an empty sequence; when the cache sequence is a non-empty sequence, obtaining the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame, and determining the similarity between the document key frame and the reference key frame using the similarity judgment method provided in the first aspect above; when the document key frame is not similar to the reference key frame, selecting a target key frame in the cache sequence to add to the key frame sequence, and after clearing the cache sequence, adding the document key frame to the cache sequence; when the document key frame is similar to the reference key frame, adding the document key frame to the cache sequence; a second processing module, configured to obtain the next key frame in the video frame sequence, and continue to perform document key frame extraction processing on the next key frame until the video ends and the video frame sequence is empty, and outputs the key frame sequence.

[0008] According to a fifth aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented.

[0009] According to a sixth aspect of the present disclosure, an electronic device is provided, characterized in that it includes: a processor; and a memory for storing one or more programs, which enables the one or more processors to implement the above method when the one or more programs are executed by the one or more processors.

[0010] A similarity judgment method provided by an embodiment of the present disclosure can obtain the degree of overlap of the first document image and the second document image by calculating the intersection-and-union ratio parameter between the first document image and the second document image, and then determine the similarity of the first document image and the second document image based on the intersection-and-union ratio parameter and the preset similarity condition. By calculating the intersection-and-union ratio parameter that characterizes the degree of overlap of the first document image and the second document image, the similarity judgment of the document images can be carried out in a targeted manner, avoiding the problem that the similarity judgment of the document images cannot be carried out based on the design features.

[0011] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0013] Figure 1 A schematic diagram showing an exemplary system architecture to which embodiments of the present disclosure may be applied;

[0014] Figure 2 Two document images are schematically shown;

[0015] Figure 3 The schematic diagram shows Figure 2 The two document images shown are the result of size normalization;

[0016] Figure 4 The schematic diagram shows Figure 3 The result of discrete Fourier transform of the document image after normalization of the size shown;

[0017] Figure 5 Two PPT document images are schematically shown;

[0018] Figure 6 A flowchart schematically illustrates a similarity determination method in an exemplary embodiment of the present disclosure;

[0019] Figure 7 A flow chart schematically illustrates a method for calculating an intersection-over-union ratio parameter in an exemplary embodiment of the present disclosure;

[0020] Figure 8 Schematically illustrating two PPT document images in an exemplary embodiment of the present disclosure;

[0021] Fig. 9 Schematically illustrates an exemplary embodiment of the present disclosure. Figure 8 The two PPT document images shown are binarized to obtain the binarized images;

[0022] Fig.10 A flowchart schematically illustrates a method for bitwise AND processing in an exemplary embodiment of the present disclosure;

[0023] Fig.11 Schematically illustrating two PPT document images in an exemplary embodiment of the present disclosure;

[0024] Fig.12 Schematically illustrates an exemplary embodiment of the present disclosure. Fig.11 The two PPT document images shown are binarized and bitwise ANDed to obtain a binarized image and an intersection image;

[0025] Fig.13 Schematically illustrates an exemplary embodiment of the present disclosure. Figure 8 The two PPT document images shown are binarized and bitwise ANDed to obtain a binarized image and an intersection image;

[0026] Fig.14 Schematically illustrating two other document images in an exemplary embodiment of the present disclosure;

[0027] Fig.15 Schematically illustrates an exemplary embodiment of the present disclosure. Fig.14 The edge detection result diagram obtained by performing edge detection on the two document images shown;

[0028] Fig.16 A flow chart schematically illustrates a method for calculating feature matching parameters in an exemplary embodiment of the present disclosure;

[0029] Fig.17 A flowchart of a key frame extraction method in an exemplary embodiment of the present disclosure is schematically shown;

[0030] Fig.18 Schematically illustrates an exemplary embodiment of the present disclosure. Figure 8 The edge detection result diagram obtained by performing edge detection on the two cached key frames shown;

[0031] Fig.19 A flowchart schematically illustrates another key frame extraction method in an exemplary embodiment of the present disclosure;

[0032] Fig. 20 A schematic diagram schematically shows the composition of a similarity judgment device in an exemplary embodiment of the present disclosure;

[0033] Fig.21 A schematic diagram schematically shows the composition of a key frame extraction device in an exemplary embodiment of the present disclosure;

[0034] Fig. 22 A schematic diagram of an electronic device to which the embodiments of the present disclosure can be applied is shown. DETAILED DESCRIPTION

[0035] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0036] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0037] Figure 1 1 shows a schematic diagram of a system architecture, which may include a terminal 110 and a server 120. The terminal 110 may be a terminal device such as a smart phone, a tablet computer, a desktop computer, a laptop computer, etc. The server 120 generally refers to a background system that provides related services for similarity judgment or key frame extraction in this exemplary embodiment, and may be a server or a cluster formed by multiple servers. The terminal 110 and the server 120 may be connected via a wired or wireless communication link to perform data exchange.

[0038] In one implementation, the above similarity determination method or key frame extraction method may be performed by the terminal 110. For example, after a user uses the terminal 110 to shoot a document image, or selects a document image from an album of the terminal 110, the terminal 110 determines the similarity of the document image; for another example, after a user uses the terminal 110 to shoot a video, or selects a video from an album of the terminal 110, the terminal 110 extracts key frames from the video.

[0039] In one embodiment, the above similarity determination method or key frame extraction method may be performed by the server 120. For example, after a user uses the terminal 110 to shoot a document image, or selects a document image from the photo album of the terminal 110, the terminal 110 uploads the document image to the server 120, and the server 120 determines the similarity of the document image and returns the determination result to the terminal 110; for another example, after a user uses the terminal 110 to shoot a video, or selects a video from the photo album of the terminal 110, the terminal 110 uploads the video to the server 120, and the server 120 extracts the key frames from the video and returns the extracted key frames to the terminal 110.

[0040] As can be seen from the above, the execution subject of the similarity determination method or the key frame extraction method in this exemplary embodiment may be the above-mentioned terminal 110 or server 120, and the present disclosure does not limit this.

[0041] Online meetings have become a necessary option for people to work and study because they can be conducted remotely and without offline contact. Online meetings usually require speakers to show documents and explain them so that other participants can understand. In order to facilitate participants to record or review the meeting, the meeting summary can be automatically generated by extracting the shown documents and removing the repeated parts. In order to achieve the above purpose of automatically generating meeting summaries, it is often necessary to identify duplicate frames of video frames.

[0042] Related technical solutions that rely on artificially designed features to calculate the similarity between two images to determine whether they are similar usually perform repeated recognition on regular images. For video frames with small differences such as document images in different frames of the same document video, correct judgment results are often not obtained.

[0043] For example, refer to Figure 2 , Figure 3 and Figure 4 As shown in the figure, by perceptual hash distance Figure 2 When judging the similarity of two document images with large differences, the difference is smaller after normalizing the size to 32 pixels × 32 pixels (the intermediate step of the perceptual hash distance algorithm). Figure 3 After the discrete Fourier transform, they have become exactly the same (as shown in Figure 4 ), so their perceptual hash distance is 0, i.e., the two document images are similar, but this is obviously wrong.

[0044] For example, when judging the similarity of images corresponding to animated slide presentations (PowerPoint, PPT), the conventional judgment method generally considers Figure 5 The two PPT images shown are not similar, but in a PPT presentation scenario, a more reasonable approach is to artificially make the two PPT images similar and retain the PPT image containing more elements.

[0045] Based on one or more of the above problems, this exemplary embodiment provides a similarity determination method, which can be applied to the similarity determination scenario of document images. Figure 6 As shown, the similarity determination method may include the following steps S610 to S630:

[0046] In step S610 , a first document image and a second document image are acquired.

[0047] Among them, document images generally refer to images containing a large number of texts, symbols and other highly similar elements, for example, e-book images, document images, web page images containing a large number of texts, slide presentations, etc.

[0048] In an exemplary embodiment, the first document image and the second document image may be document images taken by a user using a camera of a terminal device; the first document image and the second document image may also be document images selected by a user in a photo album of the terminal device; or one document image may be taken by a user using a camera of a terminal device, and the other document image may be selected by a user in a photo album of the terminal device. The present disclosure does not make any special limitation on this.

[0049] In step S620 , a similarity parameter is calculated based on the first document image and the second document image.

[0050] The similarity parameter includes an intersection-and-union ratio parameter. The intersection-and-union ratio parameter may include a parameter for indicating the degree of overlap between the first document image and the second document image. For example, the ratio of the intersection and the union of the first document image and the second document image; for another example, the ratio of the intersection of the first document image and the second document image to the first document image or the second document image.

[0051] In step S630, the similarity between the first document image and the second document image is determined according to the similarity parameter and the corresponding preset similarity condition.

[0052] The similarity parameters correspond to the preset similarity conditions, that is, for each similarity parameter, a corresponding preset similarity condition can be set to determine the similarity between the first document image and the second document image.

[0053] In an exemplary embodiment, when calculating the intersection-over-union parameter based on the first document image and the second document image, referring to Figure 7 As shown, it may include steps S710 to S730:

[0054] In step S710, the first document image is binarized based on the grayscale threshold to obtain a first binary image, and the second document image is binarized based on the grayscale threshold to obtain a second binary image.

[0055] Since the main content of a document image is usually represented by elements such as text or symbols, and the color and other attributes of the elements such as text or symbols are not of great concern, the color and other attribute information of the elements can be removed by binarization. In order to ensure that the same processing is performed on pixels with the same grayscale in the first document image and the second document image, so as to better compare the first document image and the second document image, the same grayscale threshold can be used for binarization processing to obtain the first binary image and the second binary image respectively. For example, for Figure 8 After the two PPT document images shown in the figure are binarized, the following can be obtained respectively: Fig. 9 The two binarized images shown.

[0056] In step S720, the first binary image and the second binary image are respectively normalized in size, and a bitwise AND process is performed on the size-normalized first binary image and the size-normalized second binary image to obtain an intersection image.

[0057] Since the bitwise AND processing requires that the pixels in the two images can correspond one to one, the first binary image and the second binary image can be size normalized before the mechanical energy bitwise AND processing. Among them, the size normalization processing refers to converting the first binary image and the second binary image into images of the same size (pixels). For example, the size of the first binary image can be converted to be consistent with the size of the second binary image; for another example, the size of the second binary image can be converted to be consistent with the size of the first binary image; for another example, the first binary image and the second binary image can also be converted to the same size, and the present disclosure does not make special restrictions on this. It should be noted that when performing size normalization, interpolation and other methods can be used to perform size transformation, for example, an interpolation algorithm of nearest neighbor sampling can be used.

[0058] In an exemplary embodiment, when performing bitwise AND processing on the size-normalized first binary image and the size-normalized second binary image to obtain an intersection image, referring to Fig.10 As shown, steps S1010 to S1030 may be included:

[0059] Step 1010 , obtaining a first grayscale value corresponding to the target pixel coordinates in the first binary image and a second grayscale value corresponding to the target pixel coordinates in the second binary image.

[0060] Step S1020, when the first grayscale value and the second grayscale value are both equal to the first preset value, determining that the value corresponding to the target pixel coordinate in the intersection image is the first preset value.

[0061] Step S1030, when the first grayscale value is not equal to the second grayscale value, or when the first grayscale value and the second grayscale value are both equal to the second preset value, determining the value of the target pixel coordinate in the intersection image to be the second preset value.

[0062] The first preset value and the second preset value are two possible values ​​of each pixel after binarization; the grayscale represented by the first preset value is higher than the grayscale represented by the second preset value.

[0063] In an exemplary embodiment, when performing bitwise AND processing, the first grayscale value and the second grayscale value corresponding to the target pixel coordinates with the same pixel coordinates in the first binary image and the second binary image can be obtained first, and then it can be determined whether the first grayscale value and the second grayscale value are both equal to the first preset value.

[0064] When the first grayscale value and the second grayscale value are both equal to the first preset value, since the grayscale represented by the first preset value is higher than the grayscale represented by the second preset value, it can be represented that the target pixels corresponding to the target pixel coordinates all have elements, and therefore the value corresponding to the pixel coordinates in the intersection image can be set to the first preset value, representing that the target pixels corresponding to the target pixel coordinates are similar, that is, intersection pixels; when the first grayscale value and the second grayscale value are not equal, it can be represented that one of the target pixels corresponding to the target pixel coordinates has an element and the other does not, and therefore the value corresponding to the target pixel coordinates in the intersection image can be set to the second preset value, representing that the target pixels corresponding to the target pixel coordinates are not similar, that is, not intersection pixels; when the first grayscale value and the second grayscale value are both equal to the second preset value, it can be represented that the target pixels corresponding to the target pixel coordinates do not have elements, and therefore the value corresponding to the pixel coordinates in the intersection image can be set to the second preset value, representing that there is no need to compare whether they are similar and they are not within the scope of calculating the intersection.

[0065] For example, suppose that when the first document image F1 and the second document image F2 are binarized, the pixels with grayscale values ​​greater than the grayscale threshold are set to 1, and the pixels with grayscale values ​​less than the grayscale threshold are set to 0, and the first binary image B1 and the second binary image B2 are obtained. At this time, for the target pixel with the target pixel coordinates (i, j), if B1(i, j) = B2(i, j) = 1, then the intersection image M corresponding to M is determined to be 1; otherwise, the intersection image M is determined to be M(i, j) = 0. For example, for example Fig.11 After binarization and bitwise AND processing of the two PPT document images, we can get the following Fig.12 The binarized image and the intersection image are shown.

[0066] In step S730, an intersection-over-union parameter is calculated based on the first binary image, the second binary image, and the intersection image.

[0067] In an exemplary embodiment, when the intersection-and-union ratio parameter is a first intersection-and-union ratio parameter that characterizes the ratio of the intersection and the union of the first document image and the second document image, the total number of pixels in the first binary image and the second binary image whose values ​​are the first preset value can be counted respectively to obtain the first pixel number and the second pixel number, and the number of intersection pixels in the intersection image whose pixel values ​​are equal to the first preset value can be counted, and then the number of union pixels is calculated based on the first pixel number, the second pixel number and the intersection pixel number, and then the ratio of the intersection pixel number to the union pixel number is directly calculated to obtain the first intersection-and-union ratio parameter.

[0068] Based on the definitions of intersection and union, the number of pixels in the union can be calculated in the following way: first calculate the sum of the number of first pixels and the number of second pixels, and then deduct the number of intersection pixels from the sum of the number of first pixels and the number of second pixels.

[0069] Correspondingly, when the intersection-and-union parameter is a first intersection-and-union parameter characterizing the ratio of the intersection and the union of the first document image and the second document image, the preset similarity condition may include a first intersection-and-union threshold. At this time, the similarity between the first document image and the second document image may be determined based on the magnitude relationship between the first intersection-and-union parameter and the first intersection-and-union threshold.

[0070] Specifically, when the first intersection-over-union parameter is greater than the first intersection-over-union threshold, it is determined that the first document image and the second document image are similar. The first intersection-over-union threshold can be set according to different document image types and specific application scenarios, for example, it can be set to 0.93, 0.95, 0.96, etc., and the present disclosure does not make special limitations on this. Preferably, the first intersection-over-union threshold can be set to 0.95 to ensure the accuracy of the result of determining the document image similarity.

[0071] The first intersection-and-union ratio parameter can be used to characterize the ratio of the intersection and the union of the first document image and the second document image. At this time, the larger the first intersection-and-union ratio parameter is, the higher the degree of overlap between the first document image and the second document image is. Therefore, by setting the first intersection-and-union ratio threshold, it can be determined that the first document image and the second document image with a high degree of overlap are similar.

[0072] In an exemplary embodiment, when the intersection-in-line parameter is a second intersection-in-line parameter characterizing the ratio of the intersection of the first document image and the second document image to the first document image, or when the intersection-in-line parameter is a second intersection-in-line parameter characterizing the ratio of the intersection of the first document image and the second document image to the second document image, the number of intersection pixels in the intersection image whose pixel value is equal to the first preset value can be counted first; then the ratio of the number of intersection pixels to the total number of images is calculated to obtain the second intersection-in-line parameter. The total number of pixels is the number of pixels contained in the first binary image or the number of pixels contained in the second binary image.

[0073] Correspondingly, when the intersection-in-union parameter is a second intersection-in-union parameter that characterizes the ratio of the intersection of the first document image and the second document image to the first document image, or when the intersection-in-union parameter is a second intersection-in-union parameter that characterizes the ratio of the intersection of the first document image and the second document image to the second document image, the preset similarity condition may include a second intersection-in-union threshold. At this time, the similarity between the first document image and the second document image may be determined based on the magnitude relationship between the second intersection-in-union parameter and the second intersection-in-union threshold.

[0074] Specifically, when the second intersection-over-union parameter is greater than the second intersection-over-union threshold, it is determined that the first document image and the second document image are similar. The second intersection-over-union threshold can also be set according to different document image types and specific application scenarios, for example, it can be set to 0.93, 0.95, 0.96, etc., and the present disclosure does not make special limitations on this. Preferably, the second intersection-over-union threshold can be set to 0.95 to ensure the accuracy of the result of determining the document image similarity.

[0075] The second intersection-over-union parameter can be used to characterize the ratio of the intersection of the first document image and the second document image to the first document image or the second document image. At this time, the larger the second intersection-over-union parameter is, the higher the consistency between the overlapping part of the first document image and the second document image and the first document image or the second document image is, that is, it can be explained that there is a relationship between the first document image and the second document image in which one image adds elements on the basis of the other image, such as Figure 8 As shown. Based on the characteristics of document images, such a relationship that one image is based on another image with added elements should be judged as similar. Therefore, by setting a second intersection-over-union threshold, it is determined that the first document image with high consistency and the second document image are similar. For example, for Figure 8 After binarization and bitwise AND processing of the two PPT document images, we can get the following Fig.13 The binary image and the intersection image shown can be determined based on the second intersection-over-union ratio parameter Figure 8 The two PPT document images shown are similar images.

[0076] In an exemplary embodiment, the similarity between the first document image and the second document image can be determined based on whether the sizes of the document images are similar. Specifically, in scenarios such as online conferences, the sizes of each frame of a video are generally the same, so the similarity between the document images can also be determined based on whether the sizes are the same.

[0077] Based on this, in an exemplary embodiment, the similarity parameter may also include a size ratio parameter. Specifically, the first aspect ratio corresponding to the first document image and the second aspect ratio corresponding to the second document image may be calculated first, and then the size relationship between the first aspect ratio and the second aspect ratio may be compared, and the larger one may be determined as the maximum aspect ratio and the smaller one may be determined as the minimum aspect ratio, and then the ratio of the minimum aspect ratio to the maximum aspect ratio may be calculated and determined as the size ratio parameter.

[0078] Correspondingly, when the similarity parameter includes a size ratio parameter, a preset similarity condition, i.e., a size ratio threshold, can be set for the size ratio parameter. At this time, when the size ratio parameter is less than or equal to the size ratio threshold, it is determined that the first document image and the second document image are not similar. It should be noted that in scenarios such as online meetings, the size of each frame of video contained in the video is usually basically the same. Therefore, when the size ratio parameter is less than or equal to the size ratio threshold, it can be determined that the first document image and the second document image are not similar; but when the size ratio parameter is greater than the size ratio threshold, the first document image and the second document image may not be similar. Among them, the size ratio threshold can also be set according to different document image types and specific application scenarios, for example, it can be set to 0.75, 0.8, 0.85, etc., and the present disclosure does not make special limitations on this. Preferably, the size ratio threshold can be set to 0.8 to ensure the accuracy of the results of determining the similarity of document images.

[0079] In addition, in some embodiments, other parameters may be set for size similarity to determine whether the first document image and the second document image are similar, and the present disclosure does not impose any special restrictions on this. For example, corresponding thresholds may be set for the length and width of the document image, respectively, and when the difference between the length of the first document image and the length of the second document image is less than or equal to the corresponding threshold, and the difference between the width of the first document image and the width of the second document image is less than or equal to the corresponding threshold, it is determined that the first document image and the second document image are not similar.

[0080] In an exemplary embodiment, the similarity between the first document image and the second document image can be determined based on the hash distance of the document images. Specifically, for conventional images, the hash algorithm can generate a corresponding string for each image, and calculate the distance between the corresponding strings to determine whether the images are similar. However, due to the particularity of the document images mentioned above, the smaller the distance calculated by the hash algorithm, the less likely it is that the document images are similar. However, it is obvious that when the distance calculated by the hash algorithm is larger, the document images can be characterized as being dissimilar. Among them, the hash algorithm can include an average hash algorithm, a perceptual hash algorithm, a differential hash algorithm, etc., and the present disclosure does not specifically limit this.

[0081] Based on this, in an exemplary embodiment, the similarity parameter may also include a hash distance parameter, and correspondingly, the preset similarity condition may include a hash distance threshold. At this time, when the hash distance parameter is greater than the hash distance threshold, it can be determined that the first document image and the second document image are not similar. Among them, the hash distance threshold can be set according to different hash algorithms, different types of document images and specific application scenarios. For example, for the perceptual hash algorithm, the hash distance threshold can be set to 14, 15, 16, etc., and the present disclosure does not make special limitations on this. Preferably, when using the perceptual hash algorithm, the hash distance threshold can be set to 15 to ensure the accuracy of the results of determining the similarity of document images.

[0082] In an exemplary embodiment, the similarity between the first document image and the second document image can be determined based on whether the distribution difference of the foreground distribution in the document images is consistent. Specifically, in the document images, the background is usually a solid color background, for example, the background of the document is usually white. Therefore, the similarity of the document images can be determined by the difference in foreground distribution. The foreground may include all contents other than the solid color background.

[0083] Based on this, in an exemplary embodiment, similarity parameters may also include edge detection parameters. Specifically, edge detection may be performed on the first document image and the second document image respectively, and a first edge detection result graph and a second edge detection result graph may be obtained accordingly. Then, a first standard deviation corresponding to the first edge detection result graph and a second standard deviation corresponding to the second edge detection result graph may be calculated respectively, and then the absolute value of the difference between the first standard deviation and the second standard deviation may be used as an edge detection parameter. When edge detection is performed on the first document image and the second document image, various edge detection algorithms may be used for edge detection, such as the Laplace algorithm, a wavelet-based image edge detection algorithm, etc., and the present disclosure does not make any special limitation on this. For example, Fig.14 Edge detection of the document image can be performed as follows: Fig.15 The edge detection result is shown in Figure .

[0084] Correspondingly, when the similarity parameter includes an edge detection parameter, the preset similarity condition may include an edge detection parameter threshold. At this time, when the edge detection parameter is greater than the edge detection parameter threshold, it is determined that the first document image and the second document image are not similar. Since the difference in the standard deviation corresponding to the edge detection result graph can characterize the degree of difference in the image foreground distribution, when the edge detection parameter is greater than the edge detection parameter threshold, it can be determined that the first document image and the second document image are not similar. Among them, the edge detection parameter threshold can be set according to different edge detection algorithms, different types of document images and specific application scenarios, for example, it can be set to 14, 15, 16, etc., and the present disclosure does not make special limitations on this. Preferably, when the Laplace algorithm is used for edge detection, the edge detection parameter threshold can be set to 15 to ensure the accuracy of the results of determining the similarity of document images.

[0085] In an exemplary embodiment, the similarity between the first document image and the second document image may also be determined based on the consistency of key points in the document images. Therefore, the similarity parameter may also include a feature matching parameter.

[0086] In an exemplary embodiment, when calculating feature matching parameters based on the first document image and the second document image, referring to Fig.16 As shown, it may include steps S1610 to S1630:

[0087] Step S1610, extracting first image key points from the first document image, and extracting second image key points from the second document image;

[0088] Step S1620, performing feature point matching on the first image key point and the second image key point to obtain a matching point pair;

[0089] Step S1630, calculating feature matching parameters based on the matching point pairs.

[0090] In an exemplary embodiment, the consistency of key points can be determined based on whether the key points match. Based on this, the first image key points and the second image key points corresponding to the first document image and the second document image can be extracted respectively, and then the first image key points and the second image key points are matched with feature points to obtain mutually matching point pairs, and then the consistency of the key points is determined based on the matching point pairs. Among them, when extracting key points, various key point extraction algorithms can be used for extraction, and the present disclosure does not make special restrictions on this. For example, the ORB (Oriented FAST and Rotated BRIEF) algorithm can be used for key point extraction.

[0091] In an exemplary embodiment, when the feature matching parameters include the proportion of matching points that characterizes the matching success rate, the number of first key points corresponding to the first image key points, the number of second key points corresponding to the second image key points, and the number of matching point pairs corresponding to the matching point pairs can be counted respectively, and then the number of first key points and the number of second key points are compared, the smaller one is taken as the minimum number of key points, and the ratio of the number of matching point pairs to the minimum number of key points is calculated to obtain the matching point proportion.

[0092] Correspondingly, when the feature matching parameter is the matching point ratio that characterizes the matching success rate, the preset similarity condition may include a matching point ratio threshold. At this time, the similarity between the first document image and the second document image can be judged based on the size relationship between the matching point ratio and the matching point ratio threshold. Specifically, when the matching point ratio is less than the matching point ratio threshold, it is determined that the first document image and the second document image are not similar. Among them, the matching point ratio threshold can be set according to different key point extraction algorithms, different types of document images and specific application scenarios, for example, it can be set to 0.4, 0.45, 0.5, etc., and the present disclosure does not make special limitations on this. Preferably, when the ORB algorithm is used for key point extraction, the matching point ratio threshold can be set to 0.45 to ensure the accuracy of the results of determining the similarity of document images.

[0093] The matching point ratio can be used to characterize the matching success rate of key points in the first document image and the second document image. At this time, the lower the matching success rate, the less matching the key points characterizing the first document image and the second document image. Therefore, by setting a matching point ratio threshold, it can be determined that the first document image and the second document image with a low matching success rate are not similar.

[0094] In an exemplary embodiment, when the feature matching parameters include effective matching ratios of effective matching point pairs in the characterization matching point pairs, the total number of matching angles in the matching point pairs, i.e., the number of effective matching point pairs, can be determined based on the matching angle clustering method, and then the ratio of the total number of matching angles to the number of matching point pairs can be calculated to obtain the effective matching ratio. Specifically, the corresponding matching angle can be calculated for each matching point pair, and the matching angles can be clustered to obtain N cluster sets, and then the N cluster sets can be sorted in descending order of the number of matching angles included in the cluster sets, and the total number of matching angles of the matching angles included in the first K cluster sets can be counted; the total number of matching point pairs, i.e., the number of matching point pairs, can be counted, and the ratio of the total number of matching angles to the number of matching point pairs can be calculated to obtain the effective matching ratio.

[0095] The matching angle can be calculated by the following formulas (1) to (4):

[0096] x=x2-x1 Formula (1)

[0097] y=y2-y1 Formula (2)

[0098]

[0099]

[0100] Among them, (x1, y1) and (x2, y2) represent the first image key point and the second image key point in a pair of matching points respectively.

[0101] Correspondingly, when the feature matching parameter is a valid matching ratio of valid matching point pairs in the characterization matching point pairs, the preset similarity condition may include a valid matching ratio threshold. At this time, the similarity between the first document image and the second document image may be determined based on the magnitude relationship between the valid matching ratio and the valid matching ratio threshold. Specifically, when the valid matching ratio is less than the valid matching ratio threshold, it is determined that the first document image and the second document image are not similar.

[0102] The value of K and the effective matching ratio threshold value can also be set according to different key point extraction algorithms, clustering algorithms, different document image types and specific application scenarios. For example, the value of K can be set to 2, 3, 4, etc., and the effective matching ratio threshold value can be set to 0.4, 0.45, 0.5, etc. The present disclosure does not make any special restrictions on this. Preferably, when the ORB algorithm is used for key point extraction and the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm is used for clustering, the value of K can be set to 3 and the effective matching ratio threshold value can be set to 0.45 to ensure the accuracy of the results of determining the similarity of document images.

[0103] Since document images usually contain a large number of words, letters, characters and other elements, and the similarity of words, letters, characters and other elements is usually relatively high, invalid mismatches often occur. At this time, the lower the effective match ratio, the more invalid mismatches there are in the matching pair, that is, the more mismatches the key points representing the first document image and the second document image, so by setting an effective match ratio threshold, it can be determined that the first document image and the second document image with a low effective match ratio are not similar.

[0104] It should be noted that if the similarity parameter includes multiple types of similarity parameters, when outputting the similarity between the first document image and the second document image, only when the similarity results determined based on the respective similarity parameters are not contradictory, can the result that the first document image and the second document image are similar be output, otherwise the result that the first document image and the second document image are not similar will be output. For example, when the similarity parameter includes both the intersection and union ratio parameter and the size ratio parameter, if the first document image and the second document image are determined to be similar based on the intersection and union ratio parameter, but the first document image and the second document image are determined to be not similar based on the size ratio parameter, that is, the similarity results determined based on the intersection and union ratio parameter and the size ratio parameter are contradictory, then the result that the first document image and the second document image are not similar needs to be output; on the contrary, if the first document image and the second document image are determined to be similar based on the intersection and union ratio parameter, and it cannot be determined that the first document image and the second document image are not similar based on the size ratio parameter, then the result that the first document image and the second document image are similar can be output.

[0105] In addition, due to the particularity of document images, each similarity parameter can only reliably determine one result. For example, for the first intersection-and-union parameter, when the first intersection-and-union parameter is greater than the first intersection-and-union threshold, it can only be reliably determined that the first document image and the second document image are similar, but it cannot be reliably determined that when the first intersection-and-union parameter is less than or equal to the first intersection-and-union threshold, the first document image and the second document image are not similar.

[0106] Based on this, in an exemplary embodiment, a situation may occur where the similarity between the first document image and the second document image cannot be determined based on a plurality of similarity parameters. Since parameters with higher computational costs are usually more reliable, the computational costs of the similarity parameters can be sorted in advance, and a result opposite to the result that can be reliably determined by the similarity parameter with the highest computational cost can be output. For example, when the similarity parameters include both the intersection-and-union ratio parameter and the size ratio parameter, and the computational cost of the intersection-and-union ratio parameter is determined to be the highest based on the computational cost. At this time, if the first document image and the second document image cannot be determined to be dissimilar based on the size ratio parameter, and the first document image and the second document image cannot be determined to be similar based on the intersection-and-union ratio parameter, since the computational cost of the intersection-and-union ratio parameter is the highest, it is necessary to output a dissimilar result (when the intersection-and-union ratio parameter can only reliably determine the result of similarity).

[0107] The following takes the example that similarity parameters include a first intersection-over-union ratio parameter, a second intersection-over-union ratio parameter, a size ratio parameter, a hash distance parameter, an edge detection parameter, a matching point ratio parameter, and a valid matching ratio parameter to describe an embodiment of the present disclosure in detail.

[0108] Assuming that the order of similarity parameters determined according to the computational cost from low to high is: size ratio parameter, hash distance parameter, edge detection parameter, first intersection-over-union parameter, second intersection-over-union parameter, matching point ratio parameter, and effective matching ratio parameter, in order to reduce the computational cost of determining the similarity and to facilitate the output of results when the similarity between the first document image and the second document image cannot be determined based on multiple similarity parameters, the similarity between the first document image and the second document image can be determined according to the similarity parameters in order from low to high computational cost.

[0109] Specifically, when making a similarity judgment for the first document image A and the second document image B, the size ratio parameter is first calculated. When the size ratio parameter is less than or equal to the size ratio threshold, it is determined that the first document image and the second document image are not similar; otherwise, the hash distance parameter is calculated. When the hash distance parameter is greater than the hash distance threshold, it is determined that the first document image and the second document image are not similar; otherwise, the edge detection parameter is calculated. When the edge detection parameter is greater than the edge detection parameter threshold, it is determined that the first document image and the second document image are not similar; otherwise, the first intersection-and-union parameter is calculated. When the first intersection-and-union parameter is greater than the first intersection-and-union threshold, it is determined that the first document image and the second document image are similar; otherwise, the second intersection-and-union parameter is calculated. When the second intersection-and-union parameter is greater than the second intersection-and-union threshold, it is determined that the first document image and the second document image are similar; otherwise, the matching point ratio parameter is calculated. When the matching point ratio is less than the matching point ratio threshold, it is determined that the first document image and the second document image are not similar; otherwise, the effective matching ratio is calculated. When the effective matching ratio is less than the effective matching ratio threshold, it is determined that the first document image and the second document image are not similar; otherwise, the first document image and the second document image are determined to be similar.

[0110] In summary, in this exemplary embodiment, the judgment method based on multiple similarity parameters in series can effectively identify similar document images. On the one hand, the hash distance parameter used to judge similarity in conventional scenarios is changed to a metric used to judge dissimilarity for document images, and the edge measurement parameter is added as an auxiliary judgment; on the other hand, the recognition effect of similar document frames is greatly enhanced through the calculation of the intersection and union ratio parameter of the binary image, the matching point ratio parameter and the effective matching ratio parameter.

[0111] This example implementation also provides a key frame extraction method, which can be applied to the scenario of extracting key frames from document frames contained in a video. Fig.17 As shown, the key frame extraction method may include the following steps S1710 and S1720:

[0112] In step S1710, a current key frame is obtained in a video frame sequence corresponding to the video, and a document key frame extraction process is performed on the current key frame.

[0113] In step S1720, the next key frame is obtained in the video frame sequence, and the document key frame extraction process is continued for the next key frame until the video ends and the video frame sequence is empty, and the key frame sequence is output.

[0114] The video frame sequence corresponding to the video may be a sequence obtained by extracting frames from the video based on a preset frame extraction rule. The frame extraction rule may include a frame extraction interval M. Specifically, a frame may be extracted from the video every M seconds and added to the video frame sequence, and then the current key frame and the next key frame may be obtained in sequence according to the order in the video frame sequence until the video ends and no further frame extraction can be performed, and the video frame sequence is empty and no further key frames can be obtained.

[0115] Among them, the document key frame extraction process may include the following steps: when the current key frame is a document frame, determine that the current key frame is a document key frame; obtain a cache sequence corresponding to the video frame sequence, and when the cache sequence is an empty sequence, add the document key frame to the cache sequence; when the cache sequence is a non-empty sequence, obtain the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame, and use the above-mentioned similarity judgment method to determine the similarity between the document key frame and the reference key frame; when the document key frame is not similar to the reference key frame, select a target key frame in the cache sequence to add to the key frame sequence, and after clearing the cache sequence, add the document key frame to the cache sequence; when the document key frame is similar to the reference key frame, add the document key frame to the cache sequence.

[0116] When performing similarity judgment, the document key frame and the reference key frame may be used as the first document image and the second document image in the above similarity judgment method for similarity judgment.

[0117] It should be noted that the above-mentioned video frame sequence, cache sequence and key frame sequence are all ordered sequences. When adding video frames, document key frames or target key frames to the sequence, the video frames, document key frames or target key frames are sorted according to the time of adding to the sequence to ensure that the video frames, document key frames or target key frames are arranged in the order of front to back in the video.

[0118] In an exemplary embodiment, during the process of document key frame extraction, cache key frames are added to the cache sequence after similarity judgment. Before the cache sequence is cleared, the cache key frames in the cache sequence are all in a similar relationship. At this time, based on the particularity of the document image, it is necessary to select the cache key frame with the clearest picture and the richest elements in the picture from the cache key frames with similar relationships as the target key frame.

[0119] Therefore, the target key frame can be determined based on the variance of the edge detection result graph that can characterize the clarity of the picture and the richness of the elements contained in the picture. Specifically, edge detection can be performed on each cached key frame in the cache sequence to obtain the corresponding edge detection result graph, and then the variance can be calculated for each edge detection result graph, and the cached key frame corresponding to the edge detection result graph with the largest variance can be determined as the target key frame. Figure 8 The edge detection of the two cached key frames shown in the figure can be obtained as follows Fig.18 The edge detection result graph shown in the figure is subjected to variance calculation, and the corresponding variances are 21.0 and 29.6 respectively. That is, the cache key frame corresponding to 29.6 should be determined as the target key frame, and the frame should be added to the key frame sequence.

[0120] When edge detection is performed on cache key frames in a cache sequence, various edge detection algorithms may be used for edge detection, such as the Laplace algorithm, a wavelet-based image edge detection algorithm, etc., and the present disclosure does not make any special limitation on this.

[0121] By calculating the variance corresponding to the edge detection result graph, the number and clarity of edges in the cached keyframe can be characterized. Specifically, the larger the variance corresponding to the edge detection result graph, the more edges there are in the cached keyframe and the clearer the image, that is, the clearer or sharper the cached keyframe is, and the richer the elements are. Therefore, based on the variance corresponding to the edge detection result graph, the document image with the clearest picture and the richest elements can be selected as the target keyframe and added to the keyframe sequence according to the particularity of the document image.

[0122] The following reference Fig.19 As shown, the technical solution of the embodiment of the present disclosure is described in detail:

[0123] Step S1901, initializing a key frame sequence and a cache sequence;

[0124] Step S1903, obtaining video stream data corresponding to the video;

[0125] Step S1905, determining whether the video has ended;

[0126] Step S1907, when the video ends, output the key frame sequence;

[0127] Step S1909, extracting a frame every M seconds as the current key frame (next key frame);

[0128] Step S1911, performing document detection on the current key frame to determine whether the current key frame is a document frame; when the current key frame is not a document frame, returning to step S1905;

[0129] Specifically, it is determined whether the current key frame contains a document. If the current key frame contains a document, the current key frame is determined to be a document frame; otherwise, the current key frame is not a document frame.

[0130] Step S1913, when the current key frame is a document frame, determining that the current key frame is a document key frame, and determining whether the cache sequence is empty;

[0131] Step S1915, when the cache sequence is a non-empty sequence, obtaining the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame;

[0132] Step S1917, determining the similarity between the document key frame and the reference key frame;

[0133] Step S1919, when the document key frame is not similar to the reference key frame, selecting a target key frame in the cache sequence and adding it to the key frame sequence;

[0134] Step S1921, clearing the cache sequence;

[0135] Step S1923, when the cache sequence is empty, or when the document key frame is similar to the reference key frame, or after the cache sequence is cleared, the document key frame is added to the cache sequence, and the process returns to step S1905.

[0136] The step of determining the similarity between the document keyframe and the reference keyframe in the above method has been described in detail in the implementation of the similarity judgment method part. The undisclosed details can be found in the implementation of the method part, so they will not be repeated here.

[0137] In summary, in this exemplary embodiment, based on the judgment of the similarity of document images, similar document images in the video (cache sequence) can be effectively identified, and the clearest and most element-rich representative frames (target key frames) can be extracted from the similar document images based on the variance of the edge detection result graph. For scenarios such as online video conferencing where the video contains a large number of document images, the video data can be automatically analyzed. Combined with document detection technology, it is possible to extract key frames from the video data and intelligently generate meeting summaries (key frame sequences), thereby improving the user experience.

[0138] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0139] For further reference, Fig. 20As shown, in an exemplary embodiment of the present disclosure, a similarity judgment device 2000 is provided, comprising an image acquisition module 2010, a parameter calculation module 2020 and a similarity judgment module 2030. Among them:

[0140] The image acquisition module 2010 can be used to acquire a first document image and a second document image.

[0141] The parameter calculation module 220 may be used to calculate similarity parameters based on the first document image and the second document image; the similarity parameters include intersection-over-union parameters.

[0142] The similarity determination module 2030 may be configured to determine the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition.

[0143] In an exemplary embodiment, the parameter calculation module 2020 can be used to binarize the first document image based on a grayscale threshold to obtain a first binary image, and to binarize the second document image based on a grayscale threshold to obtain a second binary image; size normalize the first binary image and the second binary image, respectively, and perform bitwise AND processing on the size-normalized first binary image and the size-normalized second binary image to obtain an intersection image; calculate the intersection-over-union ratio parameter based on the first binary image, the second binary image and the intersection image.

[0144] In an exemplary embodiment, the parameter calculation module 2020 can be used to obtain a first grayscale value corresponding to the target pixel coordinates in the first binary image and a second grayscale value corresponding to the target pixel coordinates in the second binary image; when the first grayscale value and the second grayscale value are both equal to a first preset value, the value corresponding to the target pixel coordinates in the intersection image is determined to be the first preset value; when the first grayscale value and the second grayscale value are not equal, or the first grayscale value and the second grayscale value are both equal to the second preset value, the value of the target pixel coordinates in the intersection image is determined to be the second preset value.

[0145] In an exemplary embodiment, the parameter calculation module 2020 can be used to count the number of first pixels in the first binary image whose pixel values ​​are equal to a first preset value, the number of second pixels in the second binary image whose pixel values ​​are equal to the first preset value, and the number of intersection pixels in the intersection image whose pixel values ​​are equal to the first preset value; calculate the number of union pixels based on the first number of pixels, the second number of pixels and the number of intersection pixels; calculate the ratio of the number of intersection pixels to the number of union pixels to obtain a first intersection-to-union ratio parameter.

[0146] Correspondingly, the similarity determination module 2030 may be used to determine that the first document image and the second document image are similar when the first intersection-over-union parameter is greater than a first intersection-over-union threshold.

[0147] In an exemplary embodiment, the parameter calculation module 2020 can be used to count the number of intersection pixels in the intersection image whose pixel values ​​are equal to a first preset value; calculate the ratio of the number of intersection pixels to the total number of images to obtain a second intersection ratio parameter; the total number of pixels is the number of pixels contained in the first binary image or the number of pixels contained in the second binary image.

[0148] Correspondingly, the similarity determination module 2030 may be used to determine that the first document image and the second document image are similar when the second IoU parameter is greater than a second IoU threshold.

[0149] In an exemplary embodiment, the parameter calculation module 2020 can be used to calculate a first aspect ratio corresponding to the first document image and a second aspect ratio corresponding to the second document image; determine the maximum aspect ratio and the minimum aspect ratio in the first aspect ratio and the second aspect ratio, and calculate the ratio of the minimum aspect ratio to the maximum aspect ratio to obtain a size ratio parameter.

[0150] Correspondingly, the similarity determination module 2030 may be configured to determine that the first document image and the second document image are not similar when the size ratio parameter is less than or equal to the size ratio threshold.

[0151] In an exemplary embodiment, the similarity determination module 2030 may be configured to determine that the first document image and the second document image are not similar when the hash distance parameter is greater than a hash distance threshold.

[0152] In an exemplary embodiment, the parameter calculation module 2020 can be used to perform edge detection on a first document image to obtain a first edge detection result image, and to perform edge detection on a second document image to obtain a second edge detection result image; calculate a first standard deviation corresponding to the first edge detection result image and a second standard deviation corresponding to the second edge detection result image; calculate the absolute value of the difference between the first standard deviation and the second standard deviation to obtain edge detection parameters.

[0153] Correspondingly, the similarity determination module 2030 may be used to determine that the first document image and the second document image are not similar when the edge detection parameter is greater than the edge detection parameter threshold.

[0154] In an exemplary embodiment, the parameter calculation module 2020 can be used to extract first image key points in a first document image and second image key points in a second document image; perform feature point matching on the first image key points and the second image key points to obtain matching point pairs; and calculate feature matching parameters based on the matching point pairs.

[0155] In an exemplary embodiment, the parameter calculation module 2020 can be used to count the number of first key points corresponding to the first image key points, the number of second key points corresponding to the second image key points, and the number of matching point pairs corresponding to the matching point pairs; determine the minimum number of key points between the first number of key points and the second number of key points, and calculate the ratio of the number of matching point pairs to the minimum number of key points to obtain the matching point ratio.

[0156] Correspondingly, the similarity judgment module 2030 may be used to determine that the first document image and the second document image are not similar when the matching point ratio is less than a matching point ratio threshold.

[0157] In an exemplary embodiment, the parameter calculation module 2020 can be used to calculate the matching angle corresponding to each matching point pair, and cluster the matching angles to obtain N cluster sets; wherein N is a positive integer; the N cluster sets are sorted in descending order of the number of matching angles contained, and the total number of matching angles contained in the first K cluster sets is counted; wherein K is a positive integer less than N; the number of matching point pairs corresponding to the matching point pairs is counted, and the ratio of the total number of matching angles to the number of matching point pairs is calculated to obtain the effective matching ratio

[0158] Correspondingly, the similarity judgment module 2030 may be used to determine that the first document image and the second document image are not similar when the effective matching ratio is less than the effective matching ratio threshold.

[0159] For further reference, Fig.21 As shown, in an exemplary embodiment of the present disclosure, a key frame extraction device 2100 is provided, comprising a first processing module 2110 and a second processing module 2120. Among them:

[0160] The first processing module 2110 can be used to obtain the current key frame in the video frame sequence corresponding to the video, and perform document key frame extraction processing on the current key frame; wherein, the document key frame extraction processing includes: when the current key frame is a document frame, determining that the current key frame is a document key frame; obtaining a cache sequence corresponding to the video frame sequence, and when the cache sequence is an empty sequence, adding the document key frame to the cache sequence; when the cache sequence is a non-empty sequence, obtaining the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame, and using the above-mentioned similarity judgment method to determine the similarity between the document key frame and the reference key frame; when the document key frame is not similar to the reference key frame, selecting a target key frame in the cache sequence to add to the key frame sequence, and after clearing the cache sequence, adding the document key frame to the cache sequence; when the document key frame is similar to the reference key frame, adding the document key frame to the cache sequence.

[0161] The second processing module 2120 can be used to obtain the next key frame in the video frame sequence, and continue to perform document key frame extraction processing on the next key frame until the video ends and the video frame sequence is empty, and output the key frame sequence.

[0162] The specific details of each module in the above device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0163] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0164] In an exemplary embodiment of the present disclosure, an electronic device for implementing a similarity determination method or a key frame extraction method is also provided, and the electronic device may be the above-mentioned terminal 110 or the server 120. Generally, the electronic device may include a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the above-mentioned similarity determination method or key frame extraction method by executing the executable instructions.

[0165] Below Fig. 22 Taking the mobile terminal 2200 in the example, the structure of the electronic device in the embodiment of the present disclosure is exemplarily described. It should be understood by those skilled in the art that in addition to the components specifically used for mobile purposes, Fig. 22 The structure in the figure can also be applied to fixed type devices. In other embodiments, the mobile terminal 2200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware. The interface connection relationship between the components is only shown schematically and does not constitute a structural limitation on the mobile terminal 2200. In other embodiments, the mobile terminal 2200 may also adopt the same Fig. 22 Different interface connection methods, or a combination of multiple interface connection methods.

[0166] like Fig. 22As shown, the mobile terminal 2200 may specifically include: a processor 2210, an internal memory 2221, an external memory interface 2222, a Universal Serial Bus (USB) interface 2230, a charging management module 2240, a power management module 2241, a battery 2242, an antenna 1, an antenna 2, a mobile communication module 2250, a wireless communication module 2260, an audio module 2270, a speaker 2271, a receiver 2272, a microphone 2273, an earphone interface 2274, a sensor module 2280, a display screen 2290, a camera module 2291, an indicator 2292, a motor 2293, a button 2294, and a subscriber identification module (SIM) card interface 2295, etc. The sensor module 2280 may include a depth sensor 22801, a pressure sensor 22802, a gyroscope sensor 22803, etc.

[0167] The processor 2210 may include one or more processing units, for example, the processor 2210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor and / or a neural network processor (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0168] The processor 2210 is provided with a memory. The memory can store instructions for implementing six modular functions: detection instructions, connection instructions, information management instructions, analysis instructions, data transmission instructions, and notification instructions, and the execution is controlled by the processor 2210.

[0169] The mobile terminal 2200 implements the display function through a GPU, a display screen 2290, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 2290 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 2210 may include one or more GPUs that execute program instructions to generate or change display information. In some embodiments, the online conference video can be displayed through the GPU, the display screen 2290, and the application processor, and key frames of the video can be collected.

[0170] The mobile terminal 2200 can realize the shooting function through the ISP, the camera module 2291, the video codec, the GPU, the display screen 2290 and the application processor. Among them, the ISP is used to process the data fed back by the camera module 2291; the camera module 2291 is used to capture static images or videos; the digital signal processor is used to process digital signals, and in addition to processing digital image signals, it can also process other digital signals; the video codec is used to compress or decompress digital videos, and the mobile terminal 2200 can also support one or more video codecs. In some embodiments, the ISP, the camera module 2291, the video codec, the GPU, the display screen 2290 and the application processor can be used to collect videos and extract key frames from the videos.

[0171] The depth sensor 22801 is used to obtain the depth information of the scene. The pressure sensor 228022 is used to sense the pressure signal and can convert the pressure signal into an electrical signal. The gyroscope sensor 22803 can be used to determine the motion posture of the mobile terminal 2200. In addition, sensors with other functions can be set in the sensor module 2280 according to actual needs, such as an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.

[0172] The mobile terminal 2200 may also include other devices that provide auxiliary functions. For example, the key 2294 includes a power key, a volume key, etc., and the user can input through the key to generate key signal input related to the user settings and function control of the mobile terminal 2200. Another example is the indicator 2292, the motor 2293, the SIM card interface 2295, etc.

[0173] In addition, the exemplary embodiments of the present disclosure further provide a computer-readable storage medium on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of the present specification, for example, the program product may be executed. Figure 6 , Figure 7 , Fig.10 , Fig.16 , Fig.17 And any one or more steps in Figure 19.

[0174] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0175] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0176] In addition, program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0177] Those skilled in the art will readily appreciate other embodiments 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 that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0178] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A key frame extraction method, It is characterized in that include: Obtaining a current key frame in a video frame sequence corresponding to the video, and performing document key frame extraction processing on the current key frame; The document key frame extraction process includes: When the current key frame is a document frame, determining that the current key frame is a document key frame; Acquire a cache sequence corresponding to the video frame sequence, and when the cache sequence is an empty sequence, add the document key frame to the cache sequence; When the cache sequence is a non-empty sequence, obtaining the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame, and determining the similarity between the document key frame and the reference key frame; When the document key frame is not similar to the reference key frame, selecting a target key frame in the cache sequence to add to the key frame sequence, and adding the document key frame to the cache sequence after clearing the cache sequence; When the document key frame is similar to the reference key frame, adding the document key frame to the cache sequence; Acquire the next key frame in the video frame sequence, and continue to perform document key frame extraction processing on the next key frame until the video ends and the video frame sequence is empty, and output the key frame sequence; Wherein, determining the similarity between the document key frame and the reference key frame includes: Taking the document key frame and the reference key frame as a first document image and a second document image respectively, acquiring the first document image and the second document image; Calculating similarity parameters based on the first document image and the second document image, the similarity parameters comprising intersection over union parameters; The similarity between the first document image and the second document image is determined according to the similarity parameter and a corresponding preset similarity condition.

2. The method according to claim 1, It is characterized in that The step of selecting a target key frame in the cache sequence and adding it to the key frame sequence comprises: Performing edge detection on each of the cache key frames in the cache sequence to obtain a corresponding edge detection result graph; The variances corresponding to the edge detection result images are calculated, and the cache sequence corresponding to the edge detection result image with the largest variance is added as a target key frame to the key frame sequence.

3. The method according to claim 1, It is characterized in that The calculating of the similarity parameter based on the first document image and the second document image comprises: Binarizing the first document image based on a grayscale threshold to obtain a first binary image, and binarizing the second document image based on the grayscale threshold to obtain a second binary image; Normalizing the sizes of the first binary image and the second binary image respectively, and performing bitwise AND processing on the size-normalized first binary image and the size-normalized second binary image to obtain an intersection image; An intersection-over-union parameter is calculated based on the first binary image, the second binary image, and the intersection image.

4. The method according to claim 3, It is characterized in that The step of performing bitwise AND processing on the first binary image after normalization and the second binary image after normalization to obtain an intersection image includes: Obtaining a first grayscale value corresponding to the target pixel coordinates in the first binary image and a second grayscale value corresponding to the target pixel coordinates in the second binary image; When the first grayscale value and the second grayscale value are both equal to a first preset value, determining that the value corresponding to the target pixel coordinate in the intersection image is the first preset value; When the first grayscale value is not equal to the second grayscale value, or the first grayscale value and the second grayscale value are both equal to a second preset value, it is determined that the value of the target pixel coordinate in the intersection image is the second preset value.

5. The method according to claim 3, It is characterized in that The intersection-and-union ratio parameter includes a first intersection-and-union ratio parameter; the preset similarity condition includes a first intersection-and-union ratio threshold; The calculating the intersection-over-union ratio parameter based on the first binary image, the second binary image and the intersection image comprises: Counting the number of first pixels whose pixel values ​​are equal to a first preset value in the first binary image, the number of second pixels whose pixel values ​​are equal to the first preset value in the second binary image, and the number of intersection pixels whose pixel values ​​are equal to the first preset value in the intersection image; Calculate a number of union pixels based on the first number of pixels, the second number of pixels, and the number of intersection pixels; Calculating the ratio of the number of pixels in the intersection to the number of pixels in the union to obtain the first intersection-to-union ratio parameter; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the first IoU parameter is greater than the first IoU threshold, it is determined that the first document image and the second document image are similar.

6. The method according to claim 3, It is characterized in that The intersection-and-union ratio parameter includes a second intersection-and-union ratio parameter; the preset similarity condition includes a second intersection-and-union ratio threshold; The calculating the intersection-over-union ratio parameter based on the first binary image, the second binary image and the intersection image comprises: Counting the number of intersection pixels in the intersection image whose pixel values ​​are equal to a first preset value; Calculating the ratio of the number of intersection pixels to the total number of pixels to obtain the second intersection-to-union ratio parameter; the total number of pixels is the number of pixels included in the first binary image or the number of pixels included in the second binary image; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the second IoU parameter is greater than the second IoU threshold, it is determined that the first document image and the second document image are similar.

7. The method according to claim 1, It is characterized in that The similarity parameter also includes a size ratio parameter; the preset similarity condition includes a size ratio threshold; The calculating of the similarity parameter based on the first document image and the second document image comprises: Calculating a first aspect ratio corresponding to the first document image and a second aspect ratio corresponding to the second document image; Determining a maximum aspect ratio and a minimum aspect ratio among the first aspect ratios and the second aspect ratios, and calculating a ratio of the minimum aspect ratio to the maximum aspect ratio to obtain a size ratio parameter; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the size ratio parameter is less than or equal to the size ratio threshold, it is determined that the first document image and the second document image are not similar.

8. The method according to claim 1, It is characterized in that The similarity parameter also includes a hash distance parameter; the preset similarity condition includes a hash distance threshold; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the hash distance parameter is greater than the hash distance threshold, it is determined that the first document image and the second document image are not similar.

9. The method according to claim 1, It is characterized in that The similarity parameter includes an edge detection parameter; the preset similarity condition includes an edge detection parameter threshold; The calculating of the similarity parameter based on the first document image and the second document image comprises: Performing edge detection on the first document image to obtain a first edge detection result graph, and performing edge detection on the second document image to obtain a second edge detection result graph; Calculating a first standard deviation corresponding to the first edge detection result graph and a second standard deviation corresponding to the second edge detection result graph; Calculating an absolute value of a difference between the first standard deviation and the second standard deviation to obtain the edge detection parameter; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the edge detection parameter is greater than the edge detection parameter threshold, it is determined that the first document image and the second document image are not similar.

10. The method according to claim 1, It is characterized in that The similarity parameter includes a feature matching parameter, and the similarity parameter is calculated based on the first document image and the second document image, including: Extracting first image key points from the first document image, and extracting second image key points from the second document image; Performing feature point matching on the first image key points and the second image key points to obtain matching point pairs; The feature matching parameters are calculated based on the matching point pairs.

11. The method according to claim 10, It is characterized in that The feature matching parameters include the matching point ratio; the preset similarity condition includes the matching point ratio threshold; The calculating the feature matching parameters based on the matching point pairs includes: Counting the number of first key points corresponding to the first image key points, the number of second key points corresponding to the second image key points, and the number of matching point pairs corresponding to the matching point pairs; Determining a minimum number of key points between the first number of key points and the second number of key points, and calculating a ratio of the number of matching point pairs to the minimum number of key points to obtain a matching point ratio; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the matching point ratio is less than the matching point ratio threshold, it is determined that the first document image and the second document image are not similar.

12. The method according to claim 10, It is characterized in that The feature matching parameters include effective matching ratio; the preset similarity condition includes effective matching ratio threshold; The calculating the feature matching parameters based on the matching point pairs includes: Calculating the matching angle corresponding to each of the matching point pairs, and clustering the matching angles to obtain N cluster sets; wherein N is a positive integer; The N cluster sets are sorted in descending order of the number of matching angles contained therein, and the total number of matching angles contained in the first K cluster sets is counted; wherein K is a positive integer less than N; Counting the number of matching point pairs corresponding to the matching point pairs, and calculating the ratio of the total number of matching angles to the number of matching point pairs to obtain a valid matching ratio; The determining the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition includes: When the effective matching ratio is less than an effective matching ratio threshold, it is determined that the first document image and the second document image are not similar.

13. A key frame extraction device, It is characterized in that include: A first processing module is used to obtain a current key frame in a video frame sequence corresponding to the video, and perform document key frame extraction processing on the current key frame; The document key frame extraction process includes: When the current key frame is a document frame, determining that the current key frame is a document key frame; Acquire a cache sequence corresponding to the video frame sequence, and when the cache sequence is an empty sequence, add the document key frame to the cache sequence; When the cache sequence is a non-empty sequence, obtaining the last cache key frame in the cache sequence as a reference key frame corresponding to the document key frame, and determining the similarity between the document key frame and the reference key frame; When the document key frame is not similar to the reference key frame, selecting a target key frame in the cache sequence to add to the key frame sequence, and adding the document key frame to the cache sequence after clearing the cache sequence; When the document key frame is similar to the reference key frame, adding the document key frame to the cache sequence; A second processing module is used to obtain a next key frame in the video frame sequence, and continue to perform document key frame extraction processing on the next key frame until the video ends and the video frame sequence is empty, and output the key frame sequence; Wherein, the similarity between the document key frame and the reference key frame is determined based on a similarity judgment device, and the similarity judgment device includes: An image acquisition module, used for taking the document key frame and the reference key frame as the first document image and the second document image respectively, to acquire the first document image and the second document image; A parameter calculation module, configured to calculate similarity parameters based on the first document image and the second document image, wherein the similarity parameters include intersection-over-union parameters; The similarity judgment module is used to determine the similarity between the first document image and the second document image according to the similarity parameter and the corresponding preset similarity condition.

14. A computer readable medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.

15. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 12 by executing the executable instructions.