WO2017166585A1 - Method, device, and electronic apparatus for determining video transition - Google Patents

Method, device, and electronic apparatus for determining video transition Download PDF

Info

Publication number
WO2017166585A1
WO2017166585A1 PCT/CN2016/096029 CN2016096029W WO2017166585A1 WO 2017166585 A1 WO2017166585 A1 WO 2017166585A1 CN 2016096029 W CN2016096029 W CN 2016096029W WO 2017166585 A1 WO2017166585 A1 WO 2017166585A1
Authority
WO
WIPO (PCT)
Prior art keywords
mean
difference
video
value
local maximum
Prior art date
Application number
PCT/CN2016/096029
Other languages
French (fr)
Chinese (zh)
Inventor
杨帆
白茂生
魏伟
蔡砚刚
刘阳
Original Assignee
乐视控股(北京)有限公司
乐视云计算有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视控股(北京)有限公司, 乐视云计算有限公司 filed Critical 乐视控股(北京)有限公司
Publication of WO2017166585A1 publication Critical patent/WO2017166585A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/46Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering

Definitions

  • the present invention relates to the field of video processing technologies, and in particular, to a video transition method, apparatus, and electronic device.
  • transition There are multiple paragraphs and scenes in the video file. As the timeline progresses, there will be transitions and transitions between paragraphs or scenes. This switching and transition is called transition.
  • the determination of the transition time is very important for video editing work, key frame judgment, etc.
  • the common way is to manually view the video to determine the transition time, the efficiency is very low, and it also takes a lot of manpower, which in turn causes video processing work. The overall efficiency is reduced.
  • the object of the present invention is to provide a video transition determination method and apparatus, which can reduce the possibility of error in transition determination.
  • the present invention provides a video transition determination method, including:
  • the video frame number at which the video transition occurs is determined according to the value of the mean.
  • the operation of calculating the histogram corresponding to the plurality of regions divided by the video frame on the image specifically includes:
  • a histogram of the quantized images in each region is calculated.
  • the video frame is divided into a plurality of equally divided regions on the image.
  • the color of the image in each area is quantified using a standard color palette.
  • the histograms of the respective regions of adjacent video frames are respectively subjected to difference calculation by the following formula,
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • the determining, by the value of the average value, whether the video frame transition occurs in the adjacent video frame includes:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the operation of determining the video frame number of the video transition field includes:
  • the difference between each local maximum value and the local maximum mean value is processed by a K-means clustering algorithm, and the video frame number corresponding to the local maximum value classified into the maximum value is determined as the video frame in which the video transition occurs. number.
  • the present invention provides a video transition determining apparatus, including:
  • a histogram calculation module configured to calculate a histogram corresponding to each of the plurality of regions divided by the video frame on the image
  • a difference calculation module configured to perform a difference calculation on the histograms of the respective regions of the adjacent video frames
  • a difference mean acquisition module configured to remove an extreme value from the difference result and take an average value
  • the transition frame number determining module is configured to determine, according to the value of the mean, a video frame number at which a video transition occurs.
  • the histogram calculation module specifically includes:
  • a region dividing unit configured to divide the video frame into multiple regions on an image
  • a color quantization unit for quantizing the color of an image in each region
  • a histogram calculation unit for calculating a histogram of the quantized images in the respective regions.
  • the video transition determining module specifically includes:
  • a local maximum value determining unit configured to calculate a derivative of the difference mean of each video frame, and determine a local maximum of the derivative of the difference mean
  • a local maximum mean determining unit for calculating an average of all local maxima, determined to be local Maximum mean
  • the transition frame number determining unit is configured to determine, according to a difference between each local maximum value and the local maximum mean value, a video frame number at which a video transition occurs.
  • the local maximum value determining unit calculates the derivative of the difference mean of each video frame, and determines the local maximum value of the derivative of the difference mean value as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • transition frame number determining unit specifically includes:
  • An initial value setting subunit for determining a maximum value and a minimum value of all local maximum values as an initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
  • a K-means clustering unit configured to process a difference between each local maximum value and the local maximum mean value by a K-means clustering algorithm
  • the transition frame number determining subunit is configured to determine the video frame number corresponding to the local maximum value classified into the maximum value as the video frame number at which the video transition occurs.
  • the difference calculation module performs a difference calculation on the histograms of the respective regions of the adjacent video frames by using the following formula,
  • the difference mean value obtaining module is configured to remove the maximum value from the difference result and calculate the mean value, and the formula is as follows:
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • An embodiment of the present invention further discloses an electronic device including at least one processor; and, The at least one processor communicatively coupled memory; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor
  • a histogram corresponding to each of the plurality of regions divided by the video frame can be calculated; a histogram of each region of the adjacent video frame is separately subjected to a difference operation, and an average value is removed from the difference result; The value of the mean determines the video frame number at which the video transition occurs.
  • the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into a plurality of regions on the image; and The color is quantized; a histogram of the quantized image in each region is calculated.
  • the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
  • the operation of quantizing the color of the image in each area is specifically: quantizing the color of the image in each area using a standard color palette.
  • the operation of performing the difference calculation on the histograms of the respective regions of the adjacent video frames, and removing the extremum from the difference result is: using the following formula for the adjacent video frames
  • the histograms of the respective regions are subjected to difference calculations
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises: calculating a derivative of a mean difference of each video frame, and determining the difference The local maximum of the derivative of the mean; the average of all local maxima is calculated and determined as the local maximum mean; the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
  • the operation of calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is specifically: calculating the difference mean of each video frame
  • the derivative the formula is as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining the maximum value and the minimum value of all the local maximum values as The initial centroid of the K-means clustering algorithm, and the K value is chosen to be 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and classified into the maximum class The video frame number corresponding to the local maximum is determined as the video frame number at which the video transition occurs.
  • the present invention also discloses a non-volatile computer storage medium, wherein the storage medium stores computer-executable instructions that, when executed by an electronic device, enable the electronic device to: calculate a video frame in an image a histogram corresponding to each of the divided regions; performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result; determining the occurrence according to the value of the average value The video frame number of the video transition.
  • the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into a plurality of regions on the image; and The color is quantized; a histogram of the quantized image in each region is calculated.
  • the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
  • the operation of quantizing the color of the image in each area is specifically: quantifying the color of the image in each area using a standard color palette.
  • the operation of performing the difference operation on the histograms of the respective regions of the adjacent video frames, and removing the extremum from the difference result is: the adjacent video frame by the following formula
  • the histograms of the respective regions are subjected to difference calculations
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises: calculating a derivative of a difference mean of each video frame, and determining the difference The local maximum of the derivative of the mean; the average of all local maxima is calculated and determined as the local maximum mean; the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
  • the operation of calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is specifically: calculating the second derivative of the mean difference of each video frame , the formula is as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining the maximum value and the minimum value of all the local maximum values as The initial centroid of the K-means clustering algorithm, and the K value is chosen to be 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and classified into the maximum class The video frame number corresponding to the local maximum is determined as the video frame number at which the video transition occurs.
  • Embodiments of the present invention also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer
  • the computer is caused to perform the method of any of the above.
  • the video transition determining method and apparatus provided by the present invention will have video frames in The image is divided into a plurality of regions, and the histograms of the respective regions are respectively calculated, and the extremum is removed when the mean value of the histogram difference results is obtained, so that the sudden appearance or disappearance of the object on the screen can be eliminated.
  • FIG. 1 is a schematic flowchart diagram of an embodiment of a video transition determining method according to the present invention.
  • FIG. 2 is a schematic flowchart diagram of another embodiment of a video transition determining method according to the present invention.
  • FIG. 3 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention.
  • FIG. 4 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention.
  • FIG. 5 is a schematic structural diagram of an embodiment of a video transition determining apparatus according to the present invention.
  • FIG. 6 is a schematic structural diagram of another embodiment of a video transition determining apparatus according to the present invention.
  • FIG. 7 is a schematic structural diagram of still another embodiment of a video transition determining apparatus according to the present invention.
  • FIG. 8 is a schematic structural diagram of hardware of an electronic device according to an embodiment of the present invention.
  • the existing video automatic transition analysis uses a histogram of adjacent frames to determine the difference between adjacent frames, but this method is difficult to distinguish global and local changes on the image of the video frame, so it is easy to cause Misjudgment.
  • the present invention divides an image into a plurality of regions when calculating a histogram, and removes extreme values in the calculation to minimize the influence of local variations of the image on global variations.
  • connection or integral connection; may be mechanical connection or electrical connection; may be directly connected, may also be indirectly connected through an intermediate medium, or may be internal communication of two components, may be wireless connection, or may be wired connection.
  • connection or integral connection; may be mechanical connection or electrical connection; may be directly connected, may also be indirectly connected through an intermediate medium, or may be internal communication of two components, may be wireless connection, or may be wired connection.
  • FIG. 1 is a schematic flowchart diagram of an embodiment of a video transition determining method according to the present invention.
  • the video transition determining method includes:
  • Step 100 Calculate a histogram corresponding to each of the multiple regions divided by the video frame on the image
  • Step 200 Perform a difference calculation on the histograms of the respective regions of the adjacent video frames, and remove the extreme values from the difference result to obtain an average value;
  • Step 300 Determine, according to the value of the average value, a video frame number at which a video transition occurs.
  • the video frame is divided into a plurality of regions on the image, and the histograms of the respective regions are respectively calculated, and the extreme values are removed when the mean value of the histogram difference results is obtained, when the object in the screen suddenly appears or When it disappears, this local change can be removed when the mean value of the histogram difference result is obtained, thereby eliminating the interference caused by the sudden appearance or disappearance of the object on the screen, and thus reducing the error of the transition judgment. possibility.
  • FIG. 2 is a schematic flowchart diagram of another embodiment of a video transition determining method according to the present invention. Compared with the previous embodiment, the step 100 of this embodiment specifically includes:
  • Step 110 Divide the video frame into multiple regions on an image
  • Step 120 Quantify the color of the image in each area
  • Step 130 Calculate a histogram of the quantized images in the respective regions.
  • the image of the video frame may be divided into multiple regions, and the division manner and the number of divisions of the region may be preset, for example, according to a preset number of rows and columns, or according to the figure. Divide areas like the importance of different areas.
  • the video frame is divided into a plurality of equally divided regions on the image, for example, divided into four equally divided regions, that is, the width and height of each of the equally divided regions are each half of the entire image. This is more convenient in the division operation.
  • the division mode and number of regions can be adaptively adjusted according to the historical data, so as to minimize the possibility of error in the transition determination.
  • the calculation of the histogram is calculated for the color of the image in the video frame, but in general, each divided area will produce a vector of RGB (256 * 256 * 256) dimensions, involving 16,777,216 colors, which obviously consumes a lot of Computing resources, and does not have a significant impact on the judgment results. Therefore, in the present embodiment, before calculating the histogram, the color of the image in each region can be quantized, and the quantized image color can be significantly reduced, thereby improving the calculation efficiency.
  • the color of the image in each area is quantized using a standard color palette, that is, each component is equally quantized to 6 copies, so that there are only 216 colors in total, which can significantly improve the calculation efficiency.
  • other quantization methods can also be selected.
  • the result of obtaining the histogram is t is the current time and also represents the video frame number.
  • i is the i-th region in the image of the video frame.
  • the histograms of the respective regions of the adjacent video frames are respectively subjected to difference calculation by the following formula.
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • the method of removing the maximum value is adopted.
  • more than one extreme value may be selected according to the interference condition, for example, the largest first and second results in the difference result are removed. .
  • calculating the mean of the differences it is preferred to use the squared mean value shown in the previous formula, and geometrical averages or arithmetic mean values may also be employed in other embodiments.
  • a D mean can be calculated for each frame. Simply put, the greater the value of D mean , the greater the difference between the two frames. According to this difference, the video frame number at which the video transition occurs can be determined based on the value of the mean.
  • FIG. 3 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention. Compared with the previous embodiment, the step 300 of this embodiment specifically includes:
  • Step 310 Calculate a derivative of the difference mean of each video frame, and determine a local maximum of the derivative of the difference mean;
  • Step 320 Calculate an average value of all local maximum values, and determine a local maximum mean value
  • Step 330 Determine, according to a difference between each local maximum value and the local maximum mean value, a video frame number at which a video transition occurs.
  • the local maximum is determined by calculating the derivative, and the average of all the local maximums is determined to determine the local maximum mean, and the video transition can be determined according to the difference between each local maximum and the local maximum mean.
  • the video frame number of the field thereby implementing an adaptive threshold to determine the transition.
  • the step 310 preferably calculates the second derivative, which can avoid calculating too many transition frames that may be detected by too many first derivatives, and can also prevent the third derivative from detecting too few results. That is, the second derivative of the mean difference of each video frame is calculated, and the formula is as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the average value can be varied by calculating the average value, thereby achieving an adaptive determination of the most appropriate threshold.
  • FIG. 4 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention. Compared with the previous embodiment, in the embodiment, step 330 specifically includes:
  • Step 331 determining a maximum value and a minimum value of all local maximum values as the initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
  • Step 332 Process a difference between each local maximum value and the local maximum mean value by using a K-means clustering algorithm
  • Step 333 Determine a video frame number corresponding to a local maximum value classified into a maximum value as a video frame number at which a video transition occurs.
  • the K-means clustering algorithm is adopted.
  • the advantage of this algorithm is that the algorithm is simple and fast. Speed, and can avoid its biggest shortcoming, the uncertainty of the initial K. Since the K value is predetermined to be 2, and the initial centroid is also determined, the video frame number corresponding to the local maximum value classified into the maximum value is the video frame number at which the video transition occurs.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
  • FIG. 5 is a schematic structural diagram of an embodiment of a video transition determining apparatus according to the present invention.
  • the video transition determining apparatus includes: a histogram calculation module 1, a difference calculation module 2, a difference mean acquisition module 3, and a transition frame number determination module 4.
  • the histogram calculation module 1 is configured to calculate a histogram corresponding to each of the multiple regions of the video frame divided by the image;
  • the difference calculation module 2 is configured to perform a difference calculation on the histograms of the respective regions of the adjacent video frames;
  • the difference mean value obtaining module 3 is configured to take an average value after removing the extreme value from the difference result;
  • the transition frame number determining module 4 is configured to determine, according to the value of the average value, a video frame number at which a video transition occurs.
  • the video frame is divided into a plurality of regions on the image, and the histograms of the respective regions are respectively calculated, and the extreme values are removed when the mean value of the histogram difference results is obtained, when the object in the screen suddenly appears or When it disappears, this local change can be removed when the mean value of the histogram difference result is obtained, thereby eliminating the interference caused by the sudden appearance or disappearance of the object on the screen, and thus reducing the error of the transition judgment. possibility.
  • FIG. 6 is a schematic structural diagram of another embodiment of a video transition determining apparatus according to the present invention.
  • the histogram calculation module 1 of the present embodiment specifically includes an area dividing unit 11, a color quantization unit 12, and a histogram calculation unit 13.
  • the area dividing unit 11 is configured to divide the video frame into a plurality of areas on the image;
  • the color quantization unit 12 is configured to quantize the color of the image in each area;
  • the histogram calculation unit 13 is configured to calculate the quantized areas.
  • the histogram of the image is configured to calculate the quantized areas.
  • the image of the video frame may be divided into multiple regions, and the division manner and the number of divisions of the region may be preset, for example, according to a preset number of rows and columns, or according to different regions in the image. Importance to divide areas and so on.
  • the video frame is divided into a plurality of equally divided regions on the image, for example, divided into four equally divided regions, that is, the width and height of each of the equally divided regions are each half of the entire image. This is more convenient in the division operation.
  • the division mode and number of regions can be adaptively adjusted according to the historical data, so as to minimize the possibility of error in the transition determination.
  • the calculation of the histogram is calculated for the color of the image in the video frame, but in general, each divided area will produce a vector of RGB (256 * 256 * 256) dimensions, involving 16,777,216 colors, which obviously consumes a lot of Computing resources, and does not have a significant impact on the judgment results. Therefore, in the present embodiment, before calculating the histogram, the color of the image in each region can be quantized, and the quantized image color can be significantly reduced, thereby improving the calculation efficiency.
  • the color of the image in each area is quantized using a standard color palette, that is, each component is equally quantized to 6 copies, so that there are only 216 colors in total, which can significantly improve the calculation efficiency.
  • other quantization methods can also be selected.
  • the difference calculation module 2 performs a difference operation on the histograms of the respective regions of the adjacent video frames by the following formula,
  • the difference mean acquisition module 3 removes the maximum value from the difference result and calculates the mean value.
  • the formula is as follows:
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • the method of removing the maximum value is adopted.
  • more than one extreme value may be selected according to the interference condition, for example, the largest first and second results in the difference result are removed. .
  • calculating the mean of the differences it is preferred to use the squared mean value shown in the previous formula, and geometrical averages or arithmetic mean values may also be employed in other embodiments.
  • a D mean can be calculated for each frame. Simply put, the greater the value of D mean , the greater the difference between the two frames. According to this difference, the video frame number at which the video transition occurs can be determined according to the value of the mean.
  • FIG. 7 is a schematic structural diagram of still another embodiment of a video transition determining apparatus according to the present invention.
  • the video transition determining module 4 of the embodiment specifically includes a local maximum value determining unit 41, a local maximum mean value determining unit 42, and a transition field number determining unit 43.
  • the local maximum value determining unit 41 is configured to calculate a derivative of the difference mean of each video frame, and determine the mean value of the difference a local maximum of the derivative;
  • the local maximum mean determining unit 42 is configured to calculate an average of all local maxima, determined as a local maximum mean;
  • the transition frame number determining unit 43 is configured to use the local maxima and the local maximal mean The difference determines the video frame number at which the video transition occurs.
  • the local maximum is determined by calculating the derivative, and the average of all the local maximums is determined to determine the local maximum mean, and the video transition can be determined according to the difference between each local maximum and the local maximum mean.
  • the video frame number of the field thereby implementing an adaptive threshold to determine the transition.
  • the local maximum value determining unit 41 preferably calculates the second-order derivative, which can avoid calculating too many transition frames that may be detected by excessive first-order derivatives, and can also prevent the third-order derivative from detecting too few results. That is, the second derivative of the mean difference of each video frame is calculated, and the formula is as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the local maximum mean value determining unit 42 can be changed by the calculation of the average value as the overall local maximum value, thereby realizing Adaptation determines the most appropriate threshold.
  • transition frame number determining unit 43 may specifically include:
  • An initial value setting subunit for determining a maximum value and a minimum value of all local maximum values as an initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
  • a K-means clustering unit configured to process a difference between each local maximum value and the local maximum mean value by a K-means clustering algorithm
  • the transition frame number determining subunit is configured to determine the video frame number corresponding to the local maximum value classified into the maximum value as the video frame number at which the video transition occurs.
  • the K-means clustering algorithm is adopted.
  • the advantage of this algorithm is that the algorithm is simple and fast, and can avoid its biggest shortcoming, namely the uncertainty of the initial K. Since the K value is predetermined to be 2, and the initial centroid is also determined, the video frame number corresponding to the local maximum value classified into the maximum value is the video frame number at which the video transition occurs.
  • an embodiment of the present invention further discloses an electronic device including at least one processor 810; and a memory 800 communicably connected to the at least one processor 810; wherein the memory 800 stores An instruction executed by the at least one processor 810, the instruction being At least one processor 810 is configured to enable the at least one processor 810 to calculate a histogram corresponding to each of the plurality of regions of the video frame divided by the image; and perform a difference operation on the histograms of the respective regions of the adjacent video frames And taking the average value after removing the extreme value from the difference result; determining the video frame number at which the video transition occurs according to the value of the average value.
  • the electronic device also includes an input device 830 and an output device 840 that are electrically coupled to the memory 800 and the processor, the electrical connections preferably being connected by a bus.
  • the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into multiple regions on the image; The color of the inner image is quantized; the histogram of the quantized image in each region is calculated.
  • the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
  • the operation of quantizing the color of the image in each region is specifically: quantizing the color of the image in each region using a standard color palette.
  • the histograms of the respective regions of the adjacent video frames are respectively subjected to a difference operation, and the operation of removing the extremum from the difference result is performed by using the following formula:
  • the histograms of the respective regions of the video frame are respectively subjected to difference calculation,
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises: calculating a derivative of the difference mean of each video frame, and determining The local maximum of the derivative of the difference mean is calculated; the average of all local maximums is calculated and determined as the local maximum mean; and the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
  • the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is: calculating the difference of each video frame
  • the second derivative of the value, the formula is as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining a maximum value of all local maximum values and The minimum value is taken as the initial centroid of the K-means clustering algorithm, and the K value is selected as 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and the maximum value is classified.
  • the video frame number corresponding to a local maximum of one type is determined as the video frame number at which the video transition occurs.
  • the present invention also discloses a non-volatile computer storage medium, wherein the storage medium stores computer-executable instructions that, when executed by an electronic device, enable the electronic device to: calculate a video frame in an image a histogram corresponding to each of the divided regions; performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result; determining the occurrence according to the value of the average value The video frame number of the video transition.
  • the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into multiple regions on the image; The color of the inner image is quantized; the histogram of the quantized image in each region is calculated.
  • the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
  • the operation of quantizing the color of the image in each area is specifically: quantizing the color of the image in each area using a standard color palette.
  • the histograms of the respective regions of the adjacent video frames are respectively subjected to a difference operation, and the operation of removing the extremum from the difference result is performed by using the following formula:
  • the histograms of the respective regions of the video frame are respectively subjected to difference calculation,
  • Nc is the number of colors in the divided region
  • N is the number of regions divided in the image.
  • D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  • the determining, according to the value of the mean, whether the video transition occurs in the adjacent video frame comprises: calculating a derivative of the mean difference of each video frame, and determining The local maximum of the derivative of the difference mean is calculated; the average of all local maximums is calculated and determined as the local maximum mean; and the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
  • the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is: calculating the mean of the difference of each video frame.
  • the second derivative, the formula is as follows:
  • D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively.
  • the difference mean is the requirement of the t-1, t, t+1, and t+2 frames, respectively.
  • the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining a maximum value of all local maximum values and The minimum value is taken as the initial centroid of the K-means clustering algorithm, and the K value is selected as 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and the maximum value is classified.
  • the video frame number corresponding to a local maximum of one type is determined as the video frame number at which the video transition occurs.
  • Embodiments of the present invention also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer
  • the computer is caused to perform the method described in the above embodiments.
  • embodiments of the present invention may be provided as a method, system, or Computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Probability & Statistics with Applications (AREA)
  • Image Analysis (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The present invention relates to a method, device, and electronic apparatus for determining a video transition. The method for determining a video transition comprises: calculating histograms respectively corresponding to regions obtained by dividing an image of a video frame; computing differences between adjacent video frames respectively for the histograms of the regions, removing extreme values from the difference computation results, and then obtaining an average value; and determining, according to the obtained average value, a frame number of a video transition. In the present invention, an image of a video frame is divided into multiple regions, a histogram of each region is respectively calculated, and extreme values are removed during computation of an average value of difference computation results of the histograms. In this way, the present invention eliminates interference to video transition determination from a sudden appearance or disappearance of an object on a screen, thus reducing likelihood of false determination of a transition.

Description

视频转场判断方法、装置和电子设备Video transition judging method, device and electronic device
交叉引用cross reference
本申请要求在2016年03月31日提交中国专利局、申请号为201610202103.5、发明名称为“视频转场判断方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201610202103.5, entitled "Video Transition Judgment Method and Apparatus", filed on March 31, 2016, the entire contents of which is incorporated herein by reference. .
技术领域Technical field
本发明涉及视频处理技术领域,尤其涉及一种视频转场判断方法、装置和电子设备。The present invention relates to the field of video processing technologies, and in particular, to a video transition method, apparatus, and electronic device.
背景技术Background technique
在视频文件中存在着多个段落和场景,随着时间轴的进行就会出现段落或者场景之间的切换和过渡,而这种切换和过渡就被称为转场。转场时刻的确定对于视频编辑工作、关键帧的判断等方面非常重要,常见的方式是由人工浏览视频来确定转场时刻的,效率非常低下,同时还会占用大量人力,进而造成视频处理工作整体效率的降低。There are multiple paragraphs and scenes in the video file. As the timeline progresses, there will be transitions and transitions between paragraphs or scenes. This switching and transition is called transition. The determination of the transition time is very important for video editing work, key frame judgment, etc. The common way is to manually view the video to determine the transition time, the efficiency is very low, and it also takes a lot of manpower, which in turn causes video processing work. The overall efficiency is reduced.
为了解决这一问题,目前已出现了针对视频进行自动转场分析的实现方案,通过视频序列中的相邻帧的直方图的计算来确定相邻帧之间的差异是否超过门限值,由此来确定转场发生的时刻。但是,这种转场分析方式存在着一些缺点:In order to solve this problem, an implementation scheme for automatic transition analysis of video has been presented. The calculation of the histogram of adjacent frames in the video sequence determines whether the difference between adjacent frames exceeds the threshold. This determines the moment when the transition occurs. However, there are some disadvantages to this type of transition analysis:
1、在实际场景并未改变的情况下,有物体在屏幕中突然出现或者消失时可能会判定成发生转场,从而造成误判。1. In the case that the actual scene has not changed, when an object suddenly appears or disappears on the screen, it may be determined that a transition occurs, thereby causing a false positive.
2、由于涉及到大量视频帧的直方图的计算,因此计算量非常大。2. Because of the calculation of the histogram involving a large number of video frames, the amount of calculation is very large.
发明内容Summary of the invention
本发明的目的是提出一种视频转场判断方法及装置,能够减少转场判断的错误可能性。 The object of the present invention is to provide a video transition determination method and apparatus, which can reduce the possibility of error in transition determination.
为实现上述目的,本发明提供了一种视频转场判断方法,包括:To achieve the above objective, the present invention provides a video transition determination method, including:
计算视频帧在图像上划分的多个区域分别对应的直方图;Calculating a histogram corresponding to each of the plurality of regions divided by the video frame on the image;
对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;Performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result;
根据所述均值的取值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the value of the mean.
进一步的,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:Further, the operation of calculating the histogram corresponding to the plurality of regions divided by the video frame on the image specifically includes:
将所述视频帧在图像上划分为多个区域;Dividing the video frame into a plurality of regions on the image;
对各个区域内图像的颜色进行量化;Quantify the color of the image in each area;
计算量化后的各个区域内图像的直方图。A histogram of the quantized images in each region is calculated.
进一步的,所述将所述视频帧在图像上划分为多个区域的操作具体为:Further, the operation of dividing the video frame into multiple regions on the image is specifically:
将所述视频帧在图像上划分为多个等分区域。The video frame is divided into a plurality of equally divided regions on the image.
进一步的,所述对各个区域内图像的颜色进行量化的操作具体为:Further, the operation of quantifying the color of the image in each area is specifically:
采用标准颜色调色板对各个区域内图像的颜色进行量化。The color of the image in each area is quantified using a standard color palette.
进一步的,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:Further, the operations of performing the difference calculation on the histograms of the respective regions of the adjacent video frames, and removing the extremum from the difference result are:
通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,The histograms of the respective regions of adjacent video frames are respectively subjected to difference calculation by the following formula,
Figure PCTCN2016096029-appb-000001
Figure PCTCN2016096029-appb-000001
从求差结果中去掉最大值,再计算均值,公式如下:Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000002
Figure PCTCN2016096029-appb-000002
其中,
Figure PCTCN2016096029-appb-000003
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000003
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image. For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
进一步的,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:Further, the determining, by the value of the average value, whether the video frame transition occurs in the adjacent video frame includes:
计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;Calculating a derivative of the difference mean of each video frame, and determining a local maximum of the derivative of the difference mean;
计算所有局部最大值的平均值,确定为局部最大均值;Calculate the average of all local maxima and determine the local maximum mean;
根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视 频帧号。Determining the occurrence of the video transition based on the difference between each local maximum and the local maximum Frequency frame number.
进一步的,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:Further, the operation of calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is specifically:
计算各视频帧的求差均值的二阶导数,公式如下:Calculate the second derivative of the mean difference of each video frame, as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
进一步的,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:Further, the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of determining the video frame number of the video transition field includes:
确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;Determine the maximum and minimum values of all local maxima as the initial centroid of the K-means clustering algorithm, and select the K value as 2;
通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The difference between each local maximum value and the local maximum mean value is processed by a K-means clustering algorithm, and the video frame number corresponding to the local maximum value classified into the maximum value is determined as the video frame in which the video transition occurs. number.
为实现上述目的,本发明提供了一种视频转场判断装置,包括:To achieve the above object, the present invention provides a video transition determining apparatus, including:
直方图计算模块,用于计算视频帧在图像上划分的多个区域分别对应的直方图;a histogram calculation module, configured to calculate a histogram corresponding to each of the plurality of regions divided by the video frame on the image;
求差运算模块,用于对相邻视频帧的各个区域的直方图分别进行求差运算;a difference calculation module, configured to perform a difference calculation on the histograms of the respective regions of the adjacent video frames;
求差均值获取模块,用于从求差结果去除极值后取均值;a difference mean acquisition module, configured to remove an extreme value from the difference result and take an average value;
转场帧号确定模块,用于根据所述均值的取值确定发生视频转场的视频帧号。The transition frame number determining module is configured to determine, according to the value of the mean, a video frame number at which a video transition occurs.
进一步的,所述直方图计算模块具体包括:Further, the histogram calculation module specifically includes:
区域划分单元,用于将所述视频帧在图像上划分为多个区域;a region dividing unit, configured to divide the video frame into multiple regions on an image;
颜色量化单元,用于对各个区域内图像的颜色进行量化;a color quantization unit for quantizing the color of an image in each region;
直方图计算单元,用于计算量化后的各个区域内图像的直方图。A histogram calculation unit for calculating a histogram of the quantized images in the respective regions.
进一步的,所述视频转场确定模块具体包括:Further, the video transition determining module specifically includes:
局部最大值确定单元,用于计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;a local maximum value determining unit, configured to calculate a derivative of the difference mean of each video frame, and determine a local maximum of the derivative of the difference mean;
局部最大均值确定单元,用于计算所有局部最大值的平均值,确定为局部 最大均值;a local maximum mean determining unit for calculating an average of all local maxima, determined to be local Maximum mean
转场帧号确定单元,用于根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The transition frame number determining unit is configured to determine, according to a difference between each local maximum value and the local maximum mean value, a video frame number at which a video transition occurs.
进一步的,所述局部最大值确定单元,计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:Further, the local maximum value determining unit calculates the derivative of the difference mean of each video frame, and determines the local maximum value of the derivative of the difference mean value as follows:
计算各视频帧的求差均值的二阶导数,公式如下:Calculate the second derivative of the mean difference of each video frame, as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
进一步的,所述转场帧号确定单元具体包括:Further, the transition frame number determining unit specifically includes:
初始值设定子单元,用于确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;An initial value setting subunit for determining a maximum value and a minimum value of all local maximum values as an initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
K-means聚类单元,用于通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理;a K-means clustering unit, configured to process a difference between each local maximum value and the local maximum mean value by a K-means clustering algorithm;
转场帧号确定子单元,用于将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The transition frame number determining subunit is configured to determine the video frame number corresponding to the local maximum value classified into the maximum value as the video frame number at which the video transition occurs.
进一步的,所述求差运算模块,通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,Further, the difference calculation module performs a difference calculation on the histograms of the respective regions of the adjacent video frames by using the following formula,
Figure PCTCN2016096029-appb-000005
Figure PCTCN2016096029-appb-000005
所述求差均值获取模块,用于从求差结果中去掉最大值,再计算均值,公式如下:The difference mean value obtaining module is configured to remove the maximum value from the difference result and calculate the mean value, and the formula is as follows:
Figure PCTCN2016096029-appb-000006
Figure PCTCN2016096029-appb-000006
其中,
Figure PCTCN2016096029-appb-000007
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000008
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000007
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000008
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
本发明实施例又公开了一种电子设备,包括至少一个处理器;以及,与 所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够计算视频帧在图像上划分的多个区域分别对应的直方图;对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;根据所述均值的取值确定发生视频转场的视频帧号。An embodiment of the present invention further discloses an electronic device including at least one processor; and, The at least one processor communicatively coupled memory; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor A histogram corresponding to each of the plurality of regions divided by the video frame can be calculated; a histogram of each region of the adjacent video frame is separately subjected to a difference operation, and an average value is removed from the difference result; The value of the mean determines the video frame number at which the video transition occurs.
上述的电子设备,其中,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:将所述视频帧在图像上划分为多个区域;对各个区域内图像的颜色进行量化;计算量化后的各个区域内图像的直方图。In the above electronic device, the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into a plurality of regions on the image; and The color is quantized; a histogram of the quantized image in each region is calculated.
上述的电子设备,其中,所述将所述视频帧在图像上划分为多个区域的操作具体为:将所述视频帧在图像上划分为多个等分区域。In the above electronic device, the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
上述的电子设备,其中,所述对各个区域内图像的颜色进行量化的操作具体为:采用标准颜色调色板对各个区域内图像的颜色进行量化。In the above electronic device, the operation of quantizing the color of the image in each area is specifically: quantizing the color of the image in each area using a standard color palette.
上述的电子设备,其中,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,In the above electronic device, the operation of performing the difference calculation on the histograms of the respective regions of the adjacent video frames, and removing the extremum from the difference result is: using the following formula for the adjacent video frames The histograms of the respective regions are subjected to difference calculations,
Figure PCTCN2016096029-appb-000009
Figure PCTCN2016096029-appb-000009
从求差结果中去掉最大值,再计算均值,公式如下:Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000010
Figure PCTCN2016096029-appb-000010
其中,
Figure PCTCN2016096029-appb-000011
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000012
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000011
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000012
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
上述的电子设备,其中,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;计算所有局部最大值的平均值,确定为局部最大均值;根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The foregoing electronic device, wherein the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises: calculating a derivative of a mean difference of each video frame, and determining the difference The local maximum of the derivative of the mean; the average of all local maxima is calculated and determined as the local maximum mean; the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
上述的电子设备,其中,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:计算各视频帧的求差均值的二 阶导数,公式如下:In the above electronic device, the operation of calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is specifically: calculating the difference mean of each video frame The derivative, the formula is as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
上述的电子设备,其中,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The above electronic device, wherein the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining the maximum value and the minimum value of all the local maximum values as The initial centroid of the K-means clustering algorithm, and the K value is chosen to be 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and classified into the maximum class The video frame number corresponding to the local maximum is determined as the video frame number at which the video transition occurs.
本发明还公开了一种非易失性计算机存储介质,其中,所述存储介质存储有计算机可执行指令,所述计算机可执行指令当由电子设备执行时使得电子设备能够:计算视频帧在图像上划分的多个区域分别对应的直方图;对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;根据所述均值的取值确定发生视频转场的视频帧号。The present invention also discloses a non-volatile computer storage medium, wherein the storage medium stores computer-executable instructions that, when executed by an electronic device, enable the electronic device to: calculate a video frame in an image a histogram corresponding to each of the divided regions; performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result; determining the occurrence according to the value of the average value The video frame number of the video transition.
上述的存储介质,其中,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:将所述视频帧在图像上划分为多个区域;对各个区域内图像的颜色进行量化;计算量化后的各个区域内图像的直方图。The foregoing storage medium, wherein the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into a plurality of regions on the image; and The color is quantized; a histogram of the quantized image in each region is calculated.
上述的存储介质,其中,所述将所述视频帧在图像上划分为多个区域的操作具体为:将所述视频帧在图像上划分为多个等分区域。In the above storage medium, the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
上述的存储介质,其中,所述对各个区域内图像的颜色进行量化的操作具体为:采用标准颜色调色板对各个区域内图像的颜色进行量化。In the above storage medium, the operation of quantizing the color of the image in each area is specifically: quantifying the color of the image in each area using a standard color palette.
上述的存储介质,其中,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,In the above storage medium, the operation of performing the difference operation on the histograms of the respective regions of the adjacent video frames, and removing the extremum from the difference result is: the adjacent video frame by the following formula The histograms of the respective regions are subjected to difference calculations,
Figure PCTCN2016096029-appb-000013
Figure PCTCN2016096029-appb-000013
从求差结果中去掉最大值,再计算均值,公式如下: Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000014
Figure PCTCN2016096029-appb-000014
其中,
Figure PCTCN2016096029-appb-000015
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000016
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000015
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000016
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
上述的存储介质,其中,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;计算所有局部最大值的平均值,确定为局部最大均值;根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The foregoing storage medium, wherein the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises: calculating a derivative of a difference mean of each video frame, and determining the difference The local maximum of the derivative of the mean; the average of all local maxima is calculated and determined as the local maximum mean; the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
上述的存储介质,其中,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:计算各视频帧的求差均值的二阶导数,公式如下:In the above storage medium, the operation of calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is specifically: calculating the second derivative of the mean difference of each video frame , the formula is as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
上述的存储介质,其中,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The above storage medium, wherein the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining the maximum value and the minimum value of all the local maximum values as The initial centroid of the K-means clustering algorithm, and the K value is chosen to be 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and classified into the maximum class The video frame number corresponding to the local maximum is determined as the video frame number at which the video transition occurs.
本发明实施例还提供了一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行上述任一所述的方法。Embodiments of the present invention also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer The computer is caused to perform the method of any of the above.
从上面所述可以看出,本发明提供的视频转场判断方法及装置将视频帧在 图像上划分成多个区域,并分别计算各个区域的直方图,并且在求取直方图求差结果的均值时去除极值,这样就可以消除屏幕中物体突然出现或者消失对视频转场判断所带来的干扰,进而减少转场判断的错误可能性。As can be seen from the above, the video transition determining method and apparatus provided by the present invention will have video frames in The image is divided into a plurality of regions, and the histograms of the respective regions are respectively calculated, and the extremum is removed when the mean value of the histogram difference results is obtained, so that the sudden appearance or disappearance of the object on the screen can be eliminated. The interference caused, thereby reducing the possibility of error in the judgment of the transition.
附图说明DRAWINGS
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings to be used in the specific embodiments or the description of the prior art will be briefly described below, and obviously, the attached in the following description The drawings are some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative work.
图1为本发明视频转场判断方法的一实施例的流程示意图。FIG. 1 is a schematic flowchart diagram of an embodiment of a video transition determining method according to the present invention.
图2为本发明视频转场判断方法的另一实施例的流程示意图。FIG. 2 is a schematic flowchart diagram of another embodiment of a video transition determining method according to the present invention.
图3为本发明视频转场判断方法的又一实施例的流程示意图。FIG. 3 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention.
图4为本发明视频转场判断方法的再一实施例的流程示意图。FIG. 4 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention.
图5为本发明视频转场判断装置的一实施例的结构示意图。FIG. 5 is a schematic structural diagram of an embodiment of a video transition determining apparatus according to the present invention.
图6为本发明视频转场判断装置的另一实施例的结构示意图。FIG. 6 is a schematic structural diagram of another embodiment of a video transition determining apparatus according to the present invention.
图7为本发明视频转场判断装置的又一实施例的结构示意图;FIG. 7 is a schematic structural diagram of still another embodiment of a video transition determining apparatus according to the present invention; FIG.
图8为本发明实施例中电子设备的硬件结构示意图。FIG. 8 is a schematic structural diagram of hardware of an electronic device according to an embodiment of the present invention.
具体实施方式detailed description
现有的视频自动转场分析采用的是计算相邻帧的直方图来确定相邻帧之间的差异,但这种方式难以区分视频帧的图像上的全局变化和局部变化,因此很容易造成误判。本发明在计算直方图时将图像划分成多个区域,并在计算时去除极值,以便尽量排除图像的局部变化对全局变化的影响。The existing video automatic transition analysis uses a histogram of adjacent frames to determine the difference between adjacent frames, but this method is difficult to distinguish global and local changes on the image of the video frame, so it is easy to cause Misjudgment. The present invention divides an image into a plurality of regions when calculating a histogram, and removes extreme values in the calculation to minimize the influence of local variations of the image on global variations.
下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions of the present invention will be clearly and completely described in the following with reference to the accompanying drawings. It is obvious that the described embodiments are a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
在本发明的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、 “右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", The orientation or positional relationship of the indications of "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or positional relationship shown in the drawings, for convenience of description of the present invention and simplified description. Instead of indicating or implying that the device or component referred to must have a particular orientation, constructed and operated in a particular orientation, it is not to be construed as limiting the invention. Moreover, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
在本发明的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,还可以是两个元件内部的连通,可以是无线连接,也可以是有线连接。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。In the description of the present invention, it should be noted that the terms "installation", "connected", and "connected" are to be understood broadly, and may be fixed or detachable, for example, unless otherwise explicitly defined and defined. Connection, or integral connection; may be mechanical connection or electrical connection; may be directly connected, may also be indirectly connected through an intermediate medium, or may be internal communication of two components, may be wireless connection, or may be wired connection. The specific meaning of the above terms in the present invention can be understood in a specific case by those skilled in the art.
如图1所示,为本发明视频转场判断方法的一实施例的流程示意图。在本实施例中,视频转场判断方法包括:FIG. 1 is a schematic flowchart diagram of an embodiment of a video transition determining method according to the present invention. In this embodiment, the video transition determining method includes:
步骤100、计算视频帧在图像上划分的多个区域分别对应的直方图;Step 100: Calculate a histogram corresponding to each of the multiple regions divided by the video frame on the image;
步骤200、对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;Step 200: Perform a difference calculation on the histograms of the respective regions of the adjacent video frames, and remove the extreme values from the difference result to obtain an average value;
步骤300、根据所述均值的取值确定发生视频转场的视频帧号。Step 300: Determine, according to the value of the average value, a video frame number at which a video transition occurs.
在本实施例中,将视频帧在图像上划分成多个区域,并分别计算各个区域的直方图,并且在求取直方图求差结果的均值时去除极值,当屏幕中物体突然出现或者消失时,这一局部的变化可以在求取直方图求差结果的均值时被去掉,从而消除屏幕中物体突然出现或者消失对视频转场判断所带来的干扰,进而减少转场判断的错误可能性。In this embodiment, the video frame is divided into a plurality of regions on the image, and the histograms of the respective regions are respectively calculated, and the extreme values are removed when the mean value of the histogram difference results is obtained, when the object in the screen suddenly appears or When it disappears, this local change can be removed when the mean value of the histogram difference result is obtained, thereby eliminating the interference caused by the sudden appearance or disappearance of the object on the screen, and thus reducing the error of the transition judgment. possibility.
如图2所示,为本发明视频转场判断方法的另一实施例的流程示意图。与上一实施例相比,本实施例的步骤100具体包括:FIG. 2 is a schematic flowchart diagram of another embodiment of a video transition determining method according to the present invention. Compared with the previous embodiment, the step 100 of this embodiment specifically includes:
步骤110、将所述视频帧在图像上划分为多个区域;Step 110: Divide the video frame into multiple regions on an image;
步骤120、对各个区域内图像的颜色进行量化;Step 120: Quantify the color of the image in each area;
步骤130、计算量化后的各个区域内图像的直方图。Step 130: Calculate a histogram of the quantized images in the respective regions.
在本实施例中,视频帧的图像可以划分为多个区域,这个区域的划分方式和划分数量可以预先设定,例如按照预设的排数和列数进行划分,或者按照图 像中不同区域的重要性来划分区域等。优选将所述视频帧在图像上划分为多个等分区域,例如划分为4个等分区域,即每个等分区域的宽高各为整体图像的一半。这样在划分操作上更加方便。在整个视频序列的处理过程中,可以根据历史数据来自适应的调整区域的划分方式和数量,以便尽量减少转场判断的错误可能性。In this embodiment, the image of the video frame may be divided into multiple regions, and the division manner and the number of divisions of the region may be preset, for example, according to a preset number of rows and columns, or according to the figure. Divide areas like the importance of different areas. Preferably, the video frame is divided into a plurality of equally divided regions on the image, for example, divided into four equally divided regions, that is, the width and height of each of the equally divided regions are each half of the entire image. This is more convenient in the division operation. During the processing of the entire video sequence, the division mode and number of regions can be adaptively adjusted according to the historical data, so as to minimize the possibility of error in the transition determination.
直方图的计算是针对于视频帧中的图像的颜色进行计算,但通常来说,每个划分区域都会产生RGB(256*256*256)维度的向量,涉及16777216个颜色,这显然会消耗大量的计算资源,而且并不会对判断结果造成显著的影响。因此本实施例在计算直方图之前,可以先对各个区域内图像的颜色进行量化,量化后的图像颜色能够显著减少,从而使计算效率提高。优选采用标准颜色调色板对各个区域内图像的颜色进行量化,即将每个分量平均量化为6份,这样总共才有216个颜色,从而能够非常显著的提高计算效率。当然,根据直方图计算结果对最终判断结果的影响,还可以选择其它的量化方式。The calculation of the histogram is calculated for the color of the image in the video frame, but in general, each divided area will produce a vector of RGB (256 * 256 * 256) dimensions, involving 16,777,216 colors, which obviously consumes a lot of Computing resources, and does not have a significant impact on the judgment results. Therefore, in the present embodiment, before calculating the histogram, the color of the image in each region can be quantized, and the quantized image color can be significantly reduced, thereby improving the calculation efficiency. Preferably, the color of the image in each area is quantized using a standard color palette, that is, each component is equally quantized to 6 copies, so that there are only 216 colors in total, which can significantly improve the calculation efficiency. Of course, according to the influence of the histogram calculation result on the final judgment result, other quantization methods can also be selected.
通过对量化后的颜色进行直方图计算,得到直方图的结果即为
Figure PCTCN2016096029-appb-000017
t为当前时刻,也表示的是视频帧号。i为视频帧的图像中第i个区域。在步骤200中,先通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,
By performing histogram calculation on the quantized color, the result of obtaining the histogram is
Figure PCTCN2016096029-appb-000017
t is the current time and also represents the video frame number. i is the i-th region in the image of the video frame. In step 200, the histograms of the respective regions of the adjacent video frames are respectively subjected to difference calculation by the following formula.
Figure PCTCN2016096029-appb-000018
Figure PCTCN2016096029-appb-000018
从求差结果中去掉最大值,再计算均值,公式如下:Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000019
Figure PCTCN2016096029-appb-000019
其中,
Figure PCTCN2016096029-appb-000020
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000021
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000020
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000021
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
在本实施例中,采用的是去除最大值的方式,在其他实施例中也可以根据干扰情况选择取出多于一个的极值,例如去除求差结果中最大的第一个和第二个结果。在计算求差均值时,优选采用前面公式所示的平方平均值,在其他实施例中也可以采用几何平均值或者算术平均值。In this embodiment, the method of removing the maximum value is adopted. In other embodiments, more than one extreme value may be selected according to the interference condition, for example, the largest first and second results in the difference result are removed. . In calculating the mean of the differences, it is preferred to use the squared mean value shown in the previous formula, and geometrical averages or arithmetic mean values may also be employed in other embodiments.
对于所有的视频帧,每帧均可计算出一个Dmean。简单的说,Dmean的取值越大,说明两帧之间的差异越大。依照这种差异性,可以根据均值的取值确定 发生视频转场的视频帧号。For all video frames, a D mean can be calculated for each frame. Simply put, the greater the value of D mean , the greater the difference between the two frames. According to this difference, the video frame number at which the video transition occurs can be determined based on the value of the mean.
如图3所示,为本发明视频转场判断方法的又一实施例的流程示意图。与之前的实施例相比,本实施例的步骤300具体包括:FIG. 3 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention. Compared with the previous embodiment, the step 300 of this embodiment specifically includes:
步骤310、计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;Step 310: Calculate a derivative of the difference mean of each video frame, and determine a local maximum of the derivative of the difference mean;
步骤320、计算所有局部最大值的平均值,确定为局部最大均值;Step 320: Calculate an average value of all local maximum values, and determine a local maximum mean value;
步骤330、根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。Step 330: Determine, according to a difference between each local maximum value and the local maximum mean value, a video frame number at which a video transition occurs.
在本实施例中通过计算导数来确定局部最大值,并确定所有局部最大值的平均值,来确定局部最大均值,依据各个局部最大值与所述局部最大均值的差值就能够确定发生视频转场的视频帧号,从而实现自适应的阈值来判断转场。In this embodiment, the local maximum is determined by calculating the derivative, and the average of all the local maximums is determined to determine the local maximum mean, and the video transition can be determined according to the difference between each local maximum and the local maximum mean. The video frame number of the field, thereby implementing an adaptive threshold to determine the transition.
其中,步骤310优选计算二阶导数,这可避免计算一阶导数过多可能检测出的过多的转场帧,也可以避免三阶导数检测出的结果过少。即计算各视频帧的求差均值的二阶导数,公式如下:The step 310 preferably calculates the second derivative, which can avoid calculating too many transition frames that may be detected by too many first derivatives, and can also prevent the third derivative from detecting too few results. That is, the second derivative of the mean difference of each video frame is calculated, and the formula is as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
在确定出所有视频帧的求差均值的导数的局部最大值后,通过计算平均值可以能够随着整体的局部最大值的情况变化,从而实现自适应的确定最合适的阈值。After determining the local maximum of the derivative of the difference mean of all video frames, the average value can be varied by calculating the average value, thereby achieving an adaptive determination of the most appropriate threshold.
如图4所示,为本发明视频转场判断方法的再一实施例的流程示意图。与上一实施例相比,在本实施例中,步骤330具体包括:FIG. 4 is a schematic flowchart diagram of still another embodiment of a video transition determining method according to the present invention. Compared with the previous embodiment, in the embodiment, step 330 specifically includes:
步骤331、确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2; Step 331, determining a maximum value and a minimum value of all local maximum values as the initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
步骤332、通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理;Step 332: Process a difference between each local maximum value and the local maximum mean value by using a K-means clustering algorithm;
步骤333、将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。Step 333: Determine a video frame number corresponding to a local maximum value classified into a maximum value as a video frame number at which a video transition occurs.
在本实施例中采用了K-means聚类算法,这种算法的优势在于算法简单快 速,且能够避免其最大的缺点,即初始K的不确定性。因为K值被预先确定为2,而且初始质心也已确定,因此分类到最大值一类的局部最大值对应的视频帧号即为发生视频转场的视频帧号。In this embodiment, the K-means clustering algorithm is adopted. The advantage of this algorithm is that the algorithm is simple and fast. Speed, and can avoid its biggest shortcoming, the uncertainty of the initial K. Since the K value is predetermined to be 2, and the initial centroid is also determined, the video frame number corresponding to the local maximum value classified into the maximum value is the video frame number at which the video transition occurs.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。One of ordinary skill in the art will appreciate that all or part of the steps to implement the various method embodiments described above may be accomplished by hardware associated with the program instructions. The aforementioned program can be stored in a computer readable storage medium. The program, when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
如图5所示,为本发明视频转场判断装置的一实施例的结构示意图。在本实施例中,视频转场判断装置包括:直方图计算模块1、求差运算模块2、求差均值获取模块3和转场帧号确定模块4。其中,直方图计算模块1用于计算视频帧在图像上划分的多个区域分别对应的直方图;求差运算模块2用于对相邻视频帧的各个区域的直方图分别进行求差运算;求差均值获取模块3用于从求差结果去除极值后取均值;转场帧号确定模块4用于根据所述均值的取值确定发生视频转场的视频帧号。FIG. 5 is a schematic structural diagram of an embodiment of a video transition determining apparatus according to the present invention. In this embodiment, the video transition determining apparatus includes: a histogram calculation module 1, a difference calculation module 2, a difference mean acquisition module 3, and a transition frame number determination module 4. The histogram calculation module 1 is configured to calculate a histogram corresponding to each of the multiple regions of the video frame divided by the image; the difference calculation module 2 is configured to perform a difference calculation on the histograms of the respective regions of the adjacent video frames; The difference mean value obtaining module 3 is configured to take an average value after removing the extreme value from the difference result; the transition frame number determining module 4 is configured to determine, according to the value of the average value, a video frame number at which a video transition occurs.
在本实施例中,将视频帧在图像上划分成多个区域,并分别计算各个区域的直方图,并且在求取直方图求差结果的均值时去除极值,当屏幕中物体突然出现或者消失时,这一局部的变化可以在求取直方图求差结果的均值时被去掉,从而消除屏幕中物体突然出现或者消失对视频转场判断所带来的干扰,进而减少转场判断的错误可能性。In this embodiment, the video frame is divided into a plurality of regions on the image, and the histograms of the respective regions are respectively calculated, and the extreme values are removed when the mean value of the histogram difference results is obtained, when the object in the screen suddenly appears or When it disappears, this local change can be removed when the mean value of the histogram difference result is obtained, thereby eliminating the interference caused by the sudden appearance or disappearance of the object on the screen, and thus reducing the error of the transition judgment. possibility.
如图6所示,为本发明视频转场判断装置的另一实施例的结构示意图。与上一实施例相比,本实施例的直方图计算模块1具体包括:区域划分单元11、颜色量化单元12和直方图计算单元13。区域划分单元11用于将所述视频帧在图像上划分为多个区域;颜色量化单元12用于对各个区域内图像的颜色进行量化;直方图计算单元13用于计算量化后的各个区域内图像的直方图。FIG. 6 is a schematic structural diagram of another embodiment of a video transition determining apparatus according to the present invention. Compared with the previous embodiment, the histogram calculation module 1 of the present embodiment specifically includes an area dividing unit 11, a color quantization unit 12, and a histogram calculation unit 13. The area dividing unit 11 is configured to divide the video frame into a plurality of areas on the image; the color quantization unit 12 is configured to quantize the color of the image in each area; the histogram calculation unit 13 is configured to calculate the quantized areas. The histogram of the image.
在本实施例中,视频帧的图像可以划分为多个区域,这个区域的划分方式和划分数量可以预先设定,例如按照预设的排数和列数进行划分,或者按照图像中不同区域的重要性来划分区域等。优选将所述视频帧在图像上划分为多个等分区域,例如划分为4个等分区域,即每个等分区域的宽高各为整体图像的一半。这样在划分操作上更加方便。在整个视频序列的处理过程中,可以根据历史数据来自适应的调整区域的划分方式和数量,以便尽量减少转场判断的错误可能性。 In this embodiment, the image of the video frame may be divided into multiple regions, and the division manner and the number of divisions of the region may be preset, for example, according to a preset number of rows and columns, or according to different regions in the image. Importance to divide areas and so on. Preferably, the video frame is divided into a plurality of equally divided regions on the image, for example, divided into four equally divided regions, that is, the width and height of each of the equally divided regions are each half of the entire image. This is more convenient in the division operation. During the processing of the entire video sequence, the division mode and number of regions can be adaptively adjusted according to the historical data, so as to minimize the possibility of error in the transition determination.
直方图的计算是针对于视频帧中的图像的颜色进行计算,但通常来说,每个划分区域都会产生RGB(256*256*256)维度的向量,涉及16777216个颜色,这显然会消耗大量的计算资源,而且并不会对判断结果造成显著的影响。因此本实施例在计算直方图之前,可以先对各个区域内图像的颜色进行量化,量化后的图像颜色能够显著减少,从而使计算效率提高。优选采用标准颜色调色板对各个区域内图像的颜色进行量化,即将每个分量平均量化为6份,这样总共才有216个颜色,从而能够非常显著的提高计算效率。当然,根据直方图计算结果对最终判断结果的影响,还可以选择其它的量化方式。The calculation of the histogram is calculated for the color of the image in the video frame, but in general, each divided area will produce a vector of RGB (256 * 256 * 256) dimensions, involving 16,777,216 colors, which obviously consumes a lot of Computing resources, and does not have a significant impact on the judgment results. Therefore, in the present embodiment, before calculating the histogram, the color of the image in each region can be quantized, and the quantized image color can be significantly reduced, thereby improving the calculation efficiency. Preferably, the color of the image in each area is quantized using a standard color palette, that is, each component is equally quantized to 6 copies, so that there are only 216 colors in total, which can significantly improve the calculation efficiency. Of course, according to the influence of the histogram calculation result on the final judgment result, other quantization methods can also be selected.
通过对量化后的颜色进行直方图计算,得到直方图的结果即为t为当前时刻,也表示的是视频帧号。i为视频帧的图像中第i个区域。求差运算模块2通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,By performing histogram calculation on the quantized color, the result of obtaining the histogram is t is the current time and also represents the video frame number. i is the i-th region in the image of the video frame. The difference calculation module 2 performs a difference operation on the histograms of the respective regions of the adjacent video frames by the following formula,
Figure PCTCN2016096029-appb-000023
Figure PCTCN2016096029-appb-000023
求差均值获取模块3从求差结果中去掉最大值,再计算均值,公式如下:The difference mean acquisition module 3 removes the maximum value from the difference result and calculates the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000024
Figure PCTCN2016096029-appb-000024
其中,
Figure PCTCN2016096029-appb-000025
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000026
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000025
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000026
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
在本实施例中,采用的是去除最大值的方式,在其他实施例中也可以根据干扰情况选择取出多于一个的极值,例如去除求差结果中最大的第一个和第二个结果。在计算求差均值时,优选采用前面公式所示的平方平均值,在其他实施例中也可以采用几何平均值或者算术平均值。In this embodiment, the method of removing the maximum value is adopted. In other embodiments, more than one extreme value may be selected according to the interference condition, for example, the largest first and second results in the difference result are removed. . In calculating the mean of the differences, it is preferred to use the squared mean value shown in the previous formula, and geometrical averages or arithmetic mean values may also be employed in other embodiments.
对于所有的视频帧,每帧均可计算出一个Dmean。简单的说,Dmean的取值越大,说明两帧之间的差异越大。依照这种差异性,可以根据均值的取值确定发生视频转场的视频帧号。For all video frames, a D mean can be calculated for each frame. Simply put, the greater the value of D mean , the greater the difference between the two frames. According to this difference, the video frame number at which the video transition occurs can be determined according to the value of the mean.
如图7所示,为本发明视频转场判断装置的又一实施例的结构示意图。与之前的实施例相比,本实施例的视频转场确定模块4具体包括:局部最大值确定单元41、局部最大均值确定单元42和转场帧号确定单元43。其中,局部最大值确定单元41用于计算各视频帧的求差均值的导数,并确定所述求差均值 的导数的局部最大值;局部最大均值确定单元42用于计算所有局部最大值的平均值,确定为局部最大均值;转场帧号确定单元43用于根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。FIG. 7 is a schematic structural diagram of still another embodiment of a video transition determining apparatus according to the present invention. Compared with the previous embodiment, the video transition determining module 4 of the embodiment specifically includes a local maximum value determining unit 41, a local maximum mean value determining unit 42, and a transition field number determining unit 43. The local maximum value determining unit 41 is configured to calculate a derivative of the difference mean of each video frame, and determine the mean value of the difference a local maximum of the derivative; the local maximum mean determining unit 42 is configured to calculate an average of all local maxima, determined as a local maximum mean; the transition frame number determining unit 43 is configured to use the local maxima and the local maximal mean The difference determines the video frame number at which the video transition occurs.
在本实施例中通过计算导数来确定局部最大值,并确定所有局部最大值的平均值,来确定局部最大均值,依据各个局部最大值与所述局部最大均值的差值就能够确定发生视频转场的视频帧号,从而实现自适应的阈值来判断转场。In this embodiment, the local maximum is determined by calculating the derivative, and the average of all the local maximums is determined to determine the local maximum mean, and the video transition can be determined according to the difference between each local maximum and the local maximum mean. The video frame number of the field, thereby implementing an adaptive threshold to determine the transition.
其中,局部最大值确定单元41优选计算二阶导数,这可避免计算一阶导数过多可能检测出的过多的转场帧,也可以避免三阶导数检测出的结果过少。即计算各视频帧的求差均值的二阶导数,公式如下:The local maximum value determining unit 41 preferably calculates the second-order derivative, which can avoid calculating too many transition frames that may be detected by excessive first-order derivatives, and can also prevent the third-order derivative from detecting too few results. That is, the second derivative of the mean difference of each video frame is calculated, and the formula is as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
在局部最大值确定单元41确定出所有视频帧的求差均值的导数的局部最大值后,局部最大均值确定单元42通过计算平均值可以能够随着整体的局部最大值的情况变化,从而实现自适应的确定最合适的阈值。After the local maximum value determining unit 41 determines the local maximum value of the derivative of the difference mean of all the video frames, the local maximum mean value determining unit 42 can be changed by the calculation of the average value as the overall local maximum value, thereby realizing Adaptation determines the most appropriate threshold.
在进一步的实施例中,转场帧号确定单元43可以具体包括:In a further embodiment, the transition frame number determining unit 43 may specifically include:
初始值设定子单元,用于确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;An initial value setting subunit for determining a maximum value and a minimum value of all local maximum values as an initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
K-means聚类单元,用于通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理;a K-means clustering unit, configured to process a difference between each local maximum value and the local maximum mean value by a K-means clustering algorithm;
转场帧号确定子单元,用于将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The transition frame number determining subunit is configured to determine the video frame number corresponding to the local maximum value classified into the maximum value as the video frame number at which the video transition occurs.
在本实施例中采用了K-means聚类算法,这种算法的优势在于算法简单快速,且能够避免其最大的缺点,即初始K的不确定性。因为K值被预先确定为2,而且初始质心也已确定,因此分类到最大值一类的局部最大值对应的视频帧号即为发生视频转场的视频帧号。In this embodiment, the K-means clustering algorithm is adopted. The advantage of this algorithm is that the algorithm is simple and fast, and can avoid its biggest shortcoming, namely the uncertainty of the initial K. Since the K value is predetermined to be 2, and the initial centroid is also determined, the video frame number corresponding to the local maximum value classified into the maximum value is the video frame number at which the video transition occurs.
如图8所示,本发明实施例又公开了一种电子设备,包括至少一个处理器810;以及,与所述至少一个处理器810通信连接的存储器800;其中,所述存储器800存储有可被所述至少一个处理器810执行的指令,所述指令被所述 至少一个处理器810执行,以使所述至少一个处理器810能够计算视频帧在图像上划分的多个区域分别对应的直方图;对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;根据所述均值的取值确定发生视频转场的视频帧号。所述电子设备还包括与所述存储器800和所述处理器电连接的输入装置830和输出装置840,所述电连接优选为通过总线连接。As shown in FIG. 8, an embodiment of the present invention further discloses an electronic device including at least one processor 810; and a memory 800 communicably connected to the at least one processor 810; wherein the memory 800 stores An instruction executed by the at least one processor 810, the instruction being At least one processor 810 is configured to enable the at least one processor 810 to calculate a histogram corresponding to each of the plurality of regions of the video frame divided by the image; and perform a difference operation on the histograms of the respective regions of the adjacent video frames And taking the average value after removing the extreme value from the difference result; determining the video frame number at which the video transition occurs according to the value of the average value. The electronic device also includes an input device 830 and an output device 840 that are electrically coupled to the memory 800 and the processor, the electrical connections preferably being connected by a bus.
本实施例的电子设备,优选地,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:将所述视频帧在图像上划分为多个区域;对各个区域内图像的颜色进行量化;计算量化后的各个区域内图像的直方图。In the electronic device of the embodiment, preferably, the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into multiple regions on the image; The color of the inner image is quantized; the histogram of the quantized image in each region is calculated.
本实施例的电子设备,优选地,所述将所述视频帧在图像上划分为多个区域的操作具体为:将所述视频帧在图像上划分为多个等分区域。In the electronic device of this embodiment, preferably, the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
本实施例的电子设备,优选地,所述对各个区域内图像的颜色进行量化的操作具体为:采用标准颜色调色板对各个区域内图像的颜色进行量化。In the electronic device of the embodiment, preferably, the operation of quantizing the color of the image in each region is specifically: quantizing the color of the image in each region using a standard color palette.
本实施例的电子设备,优选地,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,In the electronic device of the embodiment, preferably, the histograms of the respective regions of the adjacent video frames are respectively subjected to a difference operation, and the operation of removing the extremum from the difference result is performed by using the following formula: The histograms of the respective regions of the video frame are respectively subjected to difference calculation,
Figure PCTCN2016096029-appb-000027
Figure PCTCN2016096029-appb-000027
从求差结果中去掉最大值,再计算均值,公式如下:Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000028
Figure PCTCN2016096029-appb-000028
其中,
Figure PCTCN2016096029-appb-000029
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000030
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000029
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000030
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
本实施例的电子设备,优选地,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;计算所有局部最大值的平均值,确定为局部最大均值;根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。In the electronic device of this embodiment, preferably, the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises: calculating a derivative of the difference mean of each video frame, and determining The local maximum of the derivative of the difference mean is calculated; the average of all local maximums is calculated and determined as the local maximum mean; and the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
本实施例的电子设备,优选地,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:计算各视频帧的求差均 值的二阶导数,公式如下:In the electronic device of this embodiment, preferably, the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is: calculating the difference of each video frame The second derivative of the value, the formula is as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
本实施例的电子设备,优选地,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。In the electronic device of this embodiment, preferably, the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining a maximum value of all local maximum values and The minimum value is taken as the initial centroid of the K-means clustering algorithm, and the K value is selected as 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and the maximum value is classified. The video frame number corresponding to a local maximum of one type is determined as the video frame number at which the video transition occurs.
本发明还公开了一种非易失性计算机存储介质,其中,所述存储介质存储有计算机可执行指令,所述计算机可执行指令当由电子设备执行时使得电子设备能够:计算视频帧在图像上划分的多个区域分别对应的直方图;对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;根据所述均值的取值确定发生视频转场的视频帧号。The present invention also discloses a non-volatile computer storage medium, wherein the storage medium stores computer-executable instructions that, when executed by an electronic device, enable the electronic device to: calculate a video frame in an image a histogram corresponding to each of the divided regions; performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result; determining the occurrence according to the value of the average value The video frame number of the video transition.
本实施例的存储介质,优选地,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:将所述视频帧在图像上划分为多个区域;对各个区域内图像的颜色进行量化;计算量化后的各个区域内图像的直方图。In the storage medium of the embodiment, preferably, the operation of calculating a histogram corresponding to each of the plurality of regions divided by the video frame by the video frame comprises: dividing the video frame into multiple regions on the image; The color of the inner image is quantized; the histogram of the quantized image in each region is calculated.
本实施例的存储介质,优选地,所述将所述视频帧在图像上划分为多个区域的操作具体为:将所述视频帧在图像上划分为多个等分区域。In the storage medium of the embodiment, the operation of dividing the video frame into a plurality of regions on the image is specifically: dividing the video frame into a plurality of equally divided regions on the image.
本实施例的存储介质,优选地,所述对各个区域内图像的颜色进行量化的操作具体为:采用标准颜色调色板对各个区域内图像的颜色进行量化。In the storage medium of the embodiment, preferably, the operation of quantizing the color of the image in each area is specifically: quantizing the color of the image in each area using a standard color palette.
本实施例的存储介质,优选地,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,In the storage medium of this embodiment, preferably, the histograms of the respective regions of the adjacent video frames are respectively subjected to a difference operation, and the operation of removing the extremum from the difference result is performed by using the following formula: The histograms of the respective regions of the video frame are respectively subjected to difference calculation,
Figure PCTCN2016096029-appb-000031
Figure PCTCN2016096029-appb-000031
从求差结果中去掉最大值,再计算均值,公式如下: Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
Figure PCTCN2016096029-appb-000032
Figure PCTCN2016096029-appb-000032
其中,
Figure PCTCN2016096029-appb-000033
分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
Figure PCTCN2016096029-appb-000034
为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
among them,
Figure PCTCN2016096029-appb-000033
The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
Figure PCTCN2016096029-appb-000034
For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
本实施例的存储介质,优选地,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;计算所有局部最大值的平均值,确定为局部最大均值;根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The storage medium of the embodiment, preferably, the determining, according to the value of the mean, whether the video transition occurs in the adjacent video frame comprises: calculating a derivative of the mean difference of each video frame, and determining The local maximum of the derivative of the difference mean is calculated; the average of all local maximums is calculated and determined as the local maximum mean; and the video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum mean.
本实施例的存储介质,优选地,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:计算各视频帧的求差均值的二阶导数,公式如下:In the storage medium of this embodiment, preferably, the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is: calculating the mean of the difference of each video frame. The second derivative, the formula is as follows:
D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
本实施例的存储介质,优选地,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The storage medium of this embodiment, preferably, the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises: determining a maximum value of all local maximum values and The minimum value is taken as the initial centroid of the K-means clustering algorithm, and the K value is selected as 2; the difference between each local maximum and the local maximum mean is processed by the K-means clustering algorithm, and the maximum value is classified. The video frame number corresponding to a local maximum of one type is determined as the video frame number at which the video transition occurs.
本发明实施例还提供了一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行上述实施例所述的方法。Embodiments of the present invention also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer The computer is caused to perform the method described in the above embodiments.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或 计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention may be provided as a method, system, or Computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
显然,上述实施例仅仅是为清楚地说明所作的举例,而并非对实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。而由 此所引伸出的显而易见的变化或变动仍处于本发明创造的保护范围之中。 It is apparent that the above-described embodiments are merely illustrative of the examples, and are not intended to limit the embodiments. Other variations or modifications of the various forms may be made by those skilled in the art in light of the above description. There is no need and no way to exhaust all of the implementations. By Obvious changes or variations resulting from this are still within the scope of the invention.

Claims (31)

  1. 一种视频转场判断方法,应用于终端,其特征在于,包括:A video transition judging method is applied to a terminal, and is characterized in that:
    计算视频帧在图像上划分的多个区域分别对应的直方图;Calculating a histogram corresponding to each of the plurality of regions divided by the video frame on the image;
    对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;Performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result;
    根据所述均值的取值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the value of the mean.
  2. 根据权利要求1所述的视频转场判断方法,其特征在于,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:The video transition determining method according to claim 1, wherein the calculating the histogram corresponding to the plurality of regions divided by the video frame on the image comprises:
    将所述视频帧在图像上划分为多个区域;Dividing the video frame into a plurality of regions on the image;
    对各个区域内图像的颜色进行量化;Quantify the color of the image in each area;
    计算量化后的各个区域内图像的直方图。A histogram of the quantized images in each region is calculated.
  3. 根据权利要求2所述的视频转场判断方法,其特征在于,所述将所述视频帧在图像上划分为多个区域的操作具体为:The video transition determining method according to claim 2, wherein the operation of dividing the video frame into a plurality of regions on the image is specifically:
    将所述视频帧在图像上划分为多个等分区域。The video frame is divided into a plurality of equally divided regions on the image.
  4. 根据权利要求2所述的视频转场判断方法,其特征在于,所述对各个区域内图像的颜色进行量化的操作具体为:The video transition determining method according to claim 2, wherein the operation of quantizing the color of the image in each area is specifically:
    采用标准颜色调色板对各个区域内图像的颜色进行量化。The color of the image in each area is quantified using a standard color palette.
  5. 根据权利要求1所述的视频转场判断方法,其特征在于,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:The video transition determining method according to claim 1, wherein the operation of performing a difference operation on the histograms of the respective regions of the adjacent video frames, and removing the extremum from the difference result is :
    通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,The histograms of the respective regions of adjacent video frames are respectively subjected to difference calculation by the following formula,
    Figure PCTCN2016096029-appb-100001
    Figure PCTCN2016096029-appb-100001
    从求差结果中去掉最大值,再计算均值,公式如下:Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
    Figure PCTCN2016096029-appb-100002
    Figure PCTCN2016096029-appb-100002
    其中,
    Figure PCTCN2016096029-appb-100003
    分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
    Figure PCTCN2016096029-appb-100004
    为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
    among them,
    Figure PCTCN2016096029-appb-100003
    The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
    Figure PCTCN2016096029-appb-100004
    For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  6. 根据权利要求1所述的视频转场判断方法,其特征在于,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:The video transition determining method according to claim 1, wherein the determining, by the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises:
    计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;Calculating a derivative of the difference mean of each video frame, and determining a local maximum of the derivative of the difference mean;
    计算所有局部最大值的平均值,确定为局部最大均值;Calculate the average of all local maxima and determine the local maximum mean;
    根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum.
  7. 根据权利要求6所述的视频转场判断方法,其特征在于,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:The video transition determining method according to claim 6, wherein the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is:
    计算各视频帧的求差均值的二阶导数,公式如下:Calculate the second derivative of the mean difference of each video frame, as follows:
    D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
    确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
    D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
    其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
  8. 根据权利要求6所述的视频转场判断方法,其特征在于,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:The video transition determining method according to claim 6, wherein the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises:
    确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;Determine the maximum and minimum values of all local maxima as the initial centroid of the K-means clustering algorithm, and select the K value as 2;
    通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The difference between each local maximum value and the local maximum mean value is processed by a K-means clustering algorithm, and the video frame number corresponding to the local maximum value classified into the maximum value is determined as the video frame in which the video transition occurs. number.
  9. 一种视频转场判断装置,其特征在于,包括:A video transition judging device, comprising:
    直方图计算模块,用于计算视频帧在图像上划分的多个区域分别对应的直方图;a histogram calculation module, configured to calculate a histogram corresponding to each of the plurality of regions divided by the video frame on the image;
    求差运算模块,用于对相邻视频帧的各个区域的直方图分别进行求差运算;a difference calculation module, configured to perform a difference calculation on the histograms of the respective regions of the adjacent video frames;
    求差均值获取模块,用于从求差结果去除极值后取均值;a difference mean acquisition module, configured to remove an extreme value from the difference result and take an average value;
    转场帧号确定模块,用于根据所述均值的取值确定发生视频转场的视频帧号。 The transition frame number determining module is configured to determine, according to the value of the mean, a video frame number at which a video transition occurs.
  10. 根据权利要求9所述的视频转场判断装置,其特征在于,所述直方图计算模块具体包括:The video transition judging device according to claim 9, wherein the histogram calculation module specifically comprises:
    区域划分单元,用于将所述视频帧在图像上划分为多个区域;a region dividing unit, configured to divide the video frame into multiple regions on an image;
    颜色量化单元,用于对各个区域内图像的颜色进行量化;a color quantization unit for quantizing the color of an image in each region;
    直方图计算单元,用于计算量化后的各个区域内图像的直方图。A histogram calculation unit for calculating a histogram of the quantized images in the respective regions.
  11. 根据权利要求9所述的视频转场判断装置,其特征在于,所述视频转场确定模块具体包括:The video transition determining apparatus according to claim 9, wherein the video transition determining module specifically comprises:
    局部最大值确定单元,用于计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;a local maximum value determining unit, configured to calculate a derivative of the difference mean of each video frame, and determine a local maximum of the derivative of the difference mean;
    局部最大均值确定单元,用于计算所有局部最大值的平均值,确定为局部最大均值;a local maximum mean determining unit for calculating an average value of all local maximum values, and determining the local maximum mean value;
    转场帧号确定单元,用于根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The transition frame number determining unit is configured to determine, according to a difference between each local maximum value and the local maximum mean value, a video frame number at which a video transition occurs.
  12. 根据权利要求11所述的视频转场判断装置,其特征在于,所述局部最大值确定单元,计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:The video transition determining apparatus according to claim 11, wherein said local maximum value determining unit calculates a derivative of a difference mean of each video frame, and determines a local maximum value of a derivative of said difference mean The operation is specifically as follows:
    计算各视频帧的求差均值的二阶导数,公式如下:Calculate the second derivative of the mean difference of each video frame, as follows:
    D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
    确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
    D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
    其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
  13. 根据权利要求11所述的视频转场判断装置,其特征在于,所述转场帧号确定单元具体包括:The video transition determining device according to claim 11, wherein the transition frame number determining unit specifically comprises:
    初始值设定子单元,用于确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;An initial value setting subunit for determining a maximum value and a minimum value of all local maximum values as an initial centroid of the K-means clustering algorithm, and selecting a K value of 2;
    K-means聚类单元,用于通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理;a K-means clustering unit, configured to process a difference between each local maximum value and the local maximum mean value by a K-means clustering algorithm;
    转场帧号确定子单元,用于将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The transition frame number determining subunit is configured to determine the video frame number corresponding to the local maximum value classified into the maximum value as the video frame number at which the video transition occurs.
  14. 根据权利要求9所述的视频转场判断装置,其特征在于, The video transition judging device according to claim 9, wherein:
    所述求差运算模块,通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,The difference calculation module performs a difference calculation on the histograms of the respective regions of the adjacent video frames by using the following formula,
    Figure PCTCN2016096029-appb-100005
    Figure PCTCN2016096029-appb-100005
    所述求差均值获取模块,用于从求差结果中去掉最大值,再计算均值,公式如下:The difference mean value obtaining module is configured to remove the maximum value from the difference result and calculate the mean value, and the formula is as follows:
    Figure PCTCN2016096029-appb-100006
    Figure PCTCN2016096029-appb-100006
    其中,
    Figure PCTCN2016096029-appb-100007
    分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
    Figure PCTCN2016096029-appb-100008
    为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
    among them,
    Figure PCTCN2016096029-appb-100007
    The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
    Figure PCTCN2016096029-appb-100008
    For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  15. 一种电子设备,其特征在于包括至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions Executed by the at least one processor to enable the at least one processor to
    计算视频帧在图像上划分的多个区域分别对应的直方图;Calculating a histogram corresponding to each of the plurality of regions divided by the video frame on the image;
    对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;Performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result;
    根据所述均值的取值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the value of the mean.
  16. 根据权利要求15所述的电子设备,其特征在于,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:The electronic device according to claim 15, wherein the operation of calculating the histogram corresponding to the plurality of regions divided by the video frame on the image comprises:
    将所述视频帧在图像上划分为多个区域;Dividing the video frame into a plurality of regions on the image;
    对各个区域内图像的颜色进行量化;Quantify the color of the image in each area;
    计算量化后的各个区域内图像的直方图。A histogram of the quantized images in each region is calculated.
  17. 根据权利要求16所述的电子设备,其特征在于,所述将所述视频帧在图像上划分为多个区域的操作具体为:The electronic device according to claim 16, wherein the operation of dividing the video frame into a plurality of regions on the image is specifically:
    将所述视频帧在图像上划分为多个等分区域。The video frame is divided into a plurality of equally divided regions on the image.
  18. 根据权利要求16所述的电子设备,其特征在于,所述对各个区域内图像的颜色进行量化的操作具体为:The electronic device according to claim 16, wherein the operation of quantizing the color of the image in each area is specifically:
    采用标准颜色调色板对各个区域内图像的颜色进行量化。 The color of the image in each area is quantified using a standard color palette.
  19. 根据权利要求15所述的电子设备,其特征在于,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:The electronic device according to claim 15, wherein the operation of performing the difference operation on the histograms of the respective regions of the adjacent video frames and extracting the extremum from the difference result is:
    通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,The histograms of the respective regions of adjacent video frames are respectively subjected to difference calculation by the following formula,
    Figure PCTCN2016096029-appb-100009
    Figure PCTCN2016096029-appb-100009
    从求差结果中去掉最大值,再计算均值,公式如下:Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
    Figure PCTCN2016096029-appb-100010
    Figure PCTCN2016096029-appb-100010
    其中,
    Figure PCTCN2016096029-appb-100011
    分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
    Figure PCTCN2016096029-appb-100012
    为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
    among them,
    Figure PCTCN2016096029-appb-100011
    The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
    Figure PCTCN2016096029-appb-100012
    For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  20. 根据权利要求15所述的电子设备,其特征在于,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:The electronic device according to claim 15, wherein the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises:
    计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;Calculating a derivative of the difference mean of each video frame, and determining a local maximum of the derivative of the difference mean;
    计算所有局部最大值的平均值,确定为局部最大均值;Calculate the average of all local maxima and determine the local maximum mean;
    根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum.
  21. 根据权利要求20所述的电子设备,其特征在于,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:The electronic device according to claim 20, wherein the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is:
    计算各视频帧的求差均值的二阶导数,公式如下:Calculate the second derivative of the mean difference of each video frame, as follows:
    D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
    确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
    D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
    其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
  22. 根据权利要求20所述的电子设备,其特征在于,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括: The electronic device according to claim 20, wherein the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises:
    确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;Determine the maximum and minimum values of all local maxima as the initial centroid of the K-means clustering algorithm, and select the K value as 2;
    通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The difference between each local maximum value and the local maximum mean value is processed by a K-means clustering algorithm, and the video frame number corresponding to the local maximum value classified into the maximum value is determined as the video frame in which the video transition occurs. number.
  23. 一种非易失性计算机存储介质,其特征在于:所述存储介质存储有计算机可执行指令,所述计算机可执行指令当由电子设备执行时使得电子设备能够:A non-volatile computer storage medium characterized by the storage medium storing computer-executable instructions that, when executed by an electronic device, enable the electronic device to:
    计算视频帧在图像上划分的多个区域分别对应的直方图;Calculating a histogram corresponding to each of the plurality of regions divided by the video frame on the image;
    对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值;Performing a difference operation on the histograms of the respective regions of the adjacent video frames, and taking the average value after removing the extreme values from the difference result;
    根据所述均值的取值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the value of the mean.
  24. 根据权利要求23所述的存储介质,其特征在于,所述计算视频帧在图像上划分的多个区域分别对应的直方图的操作具体包括:The storage medium according to claim 23, wherein the operation of calculating the histogram corresponding to the plurality of regions divided by the video frame on the image comprises:
    将所述视频帧在图像上划分为多个区域;Dividing the video frame into a plurality of regions on the image;
    对各个区域内图像的颜色进行量化;Quantify the color of the image in each area;
    计算量化后的各个区域内图像的直方图。A histogram of the quantized images in each region is calculated.
  25. 根据权利要求24所述的存储介质,其特征在于,所述将所述视频帧在图像上划分为多个区域的操作具体为:The storage medium according to claim 24, wherein the operation of dividing the video frame into a plurality of regions on the image is specifically:
    将所述视频帧在图像上划分为多个等分区域。The video frame is divided into a plurality of equally divided regions on the image.
  26. 根据权利要求24所述的存储介质,其特征在于,所述对各个区域内图像的颜色进行量化的操作具体为:The storage medium according to claim 24, wherein the operation of quantizing the color of the image in each area is specifically:
    采用标准颜色调色板对各个区域内图像的颜色进行量化。The color of the image in each area is quantified using a standard color palette.
  27. 根据权利要求23所述的存储介质,其特征在于,所述对相邻视频帧的各个区域的直方图分别进行求差运算,并从求差结果去除极值后取均值的操作为:The storage medium according to claim 23, wherein the operation of performing a difference operation on the histograms of the respective regions of the adjacent video frames and extracting the extremum from the difference result is:
    通过下列公式对相邻视频帧的各个区域的直方图分别进行求差运算,The histograms of the respective regions of adjacent video frames are respectively subjected to difference calculation by the following formula,
    Figure PCTCN2016096029-appb-100013
    Figure PCTCN2016096029-appb-100013
    从求差结果中去掉最大值,再计算均值,公式如下: Remove the maximum value from the difference result and calculate the mean value. The formula is as follows:
    Figure PCTCN2016096029-appb-100014
    Figure PCTCN2016096029-appb-100014
    其中,
    Figure PCTCN2016096029-appb-100015
    分别为第i个区域中第j个颜色的第t帧和第t-1帧的直方图,Nc为划分区域内颜色的个数,N为图像中划分的区域个数,
    Figure PCTCN2016096029-appb-100016
    为第t帧与第t-1帧在第i个区域的求差结果,Dmean(t)为第t帧与第t-1帧的求差结果的均值,即求差均值。
    among them,
    Figure PCTCN2016096029-appb-100015
    The histograms of the t-th frame and the t-1th frame of the jth color in the i-th region, respectively, Nc is the number of colors in the divided region, and N is the number of regions divided in the image.
    Figure PCTCN2016096029-appb-100016
    For the difference between the t-th frame and the t-1th frame in the i-th region, D mean (t) is the mean value of the difference between the t-th frame and the t-1th frame, that is, the difference mean.
  28. 根据权利要求23所述的存储介质,其特征在于,所述根据所述均值的取值确定所述相邻视频帧是否发生视频转场的操作具体包括:The storage medium according to claim 23, wherein the determining, according to the value of the mean, whether the video frame transition occurs in the adjacent video frame comprises:
    计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值;Calculating a derivative of the difference mean of each video frame, and determining a local maximum of the derivative of the difference mean;
    计算所有局部最大值的平均值,确定为局部最大均值;Calculate the average of all local maxima and determine the local maximum mean;
    根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号。The video frame number at which the video transition occurs is determined according to the difference between each local maximum and the local maximum.
  29. 根据权利要求28所述的存储介质,其特征在于,所述计算各视频帧的求差均值的导数,并确定所述求差均值的导数的局部最大值的操作具体为:The storage medium according to claim 28, wherein the calculating the derivative of the difference mean of each video frame and determining the local maximum of the derivative of the difference mean is:
    计算各视频帧的求差均值的二阶导数,公式如下:Calculate the second derivative of the mean difference of each video frame, as follows:
    D″mean(t)=Dmean(t)-2*Dmean(t+1)+Dmean(t+2);D′′ mean (t)=D mean (t)-2*D mean (t+1)+D mean (t+2);
    确定满足以下公式的所有视频帧的求差均值的二阶导数的局部最大值,Determining the local maximum of the second derivative of the mean of the differences of all video frames that satisfy the following formula,
    D″mean(t)>D″mean(t-1),且D″mean(t)>D″mean(t+1);D′′ mean (t)>D′′ mean (t-1), and D′′ mean (t)>D′′ mean (t+1);
    其中,Dmean(t-1)、Dmean(t)、Dmean(t+1)、Dmean(t+2)分别为第t-1、t、t+1、t+2帧的求差均值。Among them, D mean (t-1), D mean (t), D mean (t+1), and D mean (t+2) are the requirements of the t-1, t, t+1, and t+2 frames, respectively. The difference mean.
  30. 根据权利要求28所述的存储介质,其特征在于,所述根据各个局部最大值与所述局部最大均值的差值确定发生视频转场的视频帧号的操作具体包括:The storage medium according to claim 28, wherein the determining, according to the difference between each local maximum value and the local maximum mean value, the operation of the video frame number of the video transition field comprises:
    确定所有局部最大值中的最大值和最小值作为K-means聚类算法的初始质心,并选择K值为2;Determine the maximum and minimum values of all local maxima as the initial centroid of the K-means clustering algorithm, and select the K value as 2;
    通过K-means聚类算法对各个局部最大值与所述局部最大均值的差值进行处理,并将分类到最大值一类的局部最大值对应的视频帧号确定为发生视频转场的视频帧号。The difference between each local maximum value and the local maximum mean value is processed by a K-means clustering algorithm, and the video frame number corresponding to the local maximum value classified into the maximum value is determined as the video frame in which the video transition occurs. number.
  31. 一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机 可读存储介质上的计算机程序,所述计算机程序包括程序指令,其特征在于,当所述程序指令被计算机执行时,使所述计算机执行上述任一权利要求所述的方法。 A computer program product comprising a non-transitory computer A computer program on a readable storage medium, the computer program comprising program instructions, wherein the computer program, when executed by a computer, causes the computer to perform the method of any of the preceding claims.
PCT/CN2016/096029 2016-03-31 2016-08-19 Method, device, and electronic apparatus for determining video transition WO2017166585A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610202103.5 2016-03-31
CN201610202103.5A CN105912981A (en) 2016-03-31 2016-03-31 Video transition determination method and device

Publications (1)

Publication Number Publication Date
WO2017166585A1 true WO2017166585A1 (en) 2017-10-05

Family

ID=56745191

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/096029 WO2017166585A1 (en) 2016-03-31 2016-08-19 Method, device, and electronic apparatus for determining video transition

Country Status (2)

Country Link
CN (1) CN105912981A (en)
WO (1) WO2017166585A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107527010B (en) * 2017-07-13 2020-07-10 央视国际网络无锡有限公司 Method for extracting video gene according to local feature and motion vector
CN113542802B (en) * 2021-07-09 2023-07-14 北京百度网讯科技有限公司 Video transition method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6985623B2 (en) * 2002-06-10 2006-01-10 Pts Corporation Scene change detection by segmentation analysis
KR100816013B1 (en) * 2007-01-23 2008-03-21 (주)엑스퍼넷 Apparatus and method for detecting scene change from compressed moving picture
CN101681518A (en) * 2007-05-21 2010-03-24 三菱电机株式会社 Image difference detection method and apparatus, scene change detection method and apparatus, as well as image difference value detection method and apparatus
CN104184925A (en) * 2014-09-11 2014-12-03 刘鹏 Video scene change detection method
CN104980625A (en) * 2015-06-19 2015-10-14 新奥特(北京)视频技术有限公司 Method and apparatus of video transition detection

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102915536A (en) * 2012-08-29 2013-02-06 太原理工大学 Domain histogram lens mutation detection calculating method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6985623B2 (en) * 2002-06-10 2006-01-10 Pts Corporation Scene change detection by segmentation analysis
KR100816013B1 (en) * 2007-01-23 2008-03-21 (주)엑스퍼넷 Apparatus and method for detecting scene change from compressed moving picture
CN101681518A (en) * 2007-05-21 2010-03-24 三菱电机株式会社 Image difference detection method and apparatus, scene change detection method and apparatus, as well as image difference value detection method and apparatus
CN104184925A (en) * 2014-09-11 2014-12-03 刘鹏 Video scene change detection method
CN104980625A (en) * 2015-06-19 2015-10-14 新奥特(北京)视频技术有限公司 Method and apparatus of video transition detection

Also Published As

Publication number Publication date
CN105912981A (en) 2016-08-31

Similar Documents

Publication Publication Date Title
US10452925B2 (en) Video monitoring method and video monitoring device
US11538232B2 (en) Tracker assisted image capture
AU2016352215B2 (en) Method and device for tracking location of human face, and electronic equipment
JP2018508875A5 (en)
EP3554070B1 (en) Photograph-capture method, apparatus and storage medium
WO2018103608A1 (en) Text detection method, device and storage medium
US9262690B2 (en) Method and device for detecting glare pixels of image
US10380853B1 (en) Presence detection and detection localization
CN108509917B (en) Video scene segmentation method and device based on lens class correlation analysis
EP3526767A1 (en) Determining variance of a block of an image based on a motion vector for the block
WO2020052270A1 (en) Video review method and apparatus, and device
EP3200442B1 (en) Method and apparatus for image processing
CN108010044B (en) Video boundary detection method
WO2017166585A1 (en) Method, device, and electronic apparatus for determining video transition
WO2017028047A1 (en) Background model extracting method and apparatus and image processing device
US11373277B2 (en) Motion detection method and image processing device for motion detection
KR102065362B1 (en) Apparatus and Method for extracting peak image in continuously photographed image
CN109389624B (en) Model drift suppression method and device based on similarity measurement
WO2017101380A1 (en) Method, system, and device for hand recognition
JP6388507B2 (en) Image processing device
CN110363766A (en) Mosaic detection method, device and electronic equipment
CN110580706A (en) Method and device for extracting video background model
CN108810407A (en) A kind of image processing method, mobile terminal and computer readable storage medium
JP2014016676A5 (en)
KR101711929B1 (en) Method and apparatus for extraction of edge in image based on multi-color and multi-direction

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16896357

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16896357

Country of ref document: EP

Kind code of ref document: A1