Summary of the invention
Embodiment of the invention technical problem to be solved is, a kind of method of video image processing and device are provided.Can improve the accuracy that video scene detects.
In order to solve the problems of the technologies described above, the embodiment of the invention provides a kind of method of video image processing to comprise:
Obtain the breviary frame of adjacent video frames, wherein, said adjacent video frames is meant the former frame and the present frame of the present frame in the video;
Obtain the chromatic component of the breviary frame of said present frame and said former frame;
Obtain the chromatic component histogram of breviary frame of chromatic component histogram and said former frame of the breviary frame of said present frame;
Obtain two said histogrammic correlations, judge according to said correlation whether the scene of present frame changes.
Correspondingly, the embodiment of the invention also provides a kind of video image processing device, comprising:
The frame acquisition module is used to obtain the breviary frame of adjacent video frames, and wherein, said adjacent video frames is meant the former frame and the present frame of the present frame in the video;
The colourity acquisition module is used to obtain the chromatic component of the breviary frame of said present frame and said former frame;
The histogram acquisition module is used to obtain the chromatic component histogram of breviary frame of chromatic component histogram and said former frame of the breviary frame of said present frame;
The correlation acquisition module is used to obtain two said histogrammic correlations;
Judge module is used for judging according to said correlation whether the scene of present frame changes.
In embodiments of the present invention, only generate histogram according to the chrominance information in the frame of video, whether the scene that detects video variation has taken place, and can remove brightness and change the interference that brings, and improves the accuracy of Video Detection.Simultaneously, the object of detection is the breviary frame of adjacent video frames, and the data input when having reduced scene detection can improve the efficient of detection; And; Since detect to as if adjacent video frames can remove camera lens and move the interference that brings; That is, because normally first frame and the present frame that compare in the prior art make the result who judges become the scene difference of first frame and the present frame of video segment; If when existing camera lens to move in this fragment, can make testing result not accurate enough and real-time.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
Mainly improve the accuracy and the efficient of scene detection in embodiments of the present invention through three aspects, the one, analytic target is an adjacent video frames; The 2nd, original video frame is compressed; The 3rd, only chromatic component is analyzed.Below describe through each specific embodiment.
As shown in Figure 1, be an idiographic flow sketch map of the method for video image processing in the embodiment of the invention.This method comprises the steps.
101, obtain the breviary frame of adjacent video frames, wherein, said adjacent video frames is meant the former frame and the present frame of the present frame in the video.
This breviary frame is meant frame of video carried out the frame that obtains after the data compression, becomes the video of 80*60 like the video compression with 640*480, and follow-up the frame of video of analyzing 80*60 gets final product.
102, obtain the chromatic component of the breviary frame of said present frame and said former frame.Wherein, this breviary frame is a yuv data, and said chromatic component comprises U, V data component.
103, the chromatic component histogram of the breviary frame of the chromatic component histogram of the breviary frame of the said present frame of acquisition and said former frame.
Wherein, the abscissa in the chromatic component histogram is represented the chromatic component of breviary frame, and ordinate is represented the number of the pixel of the screen that the video playback zone is corresponding.
104, obtain two said histogrammic correlations, judge according to said correlation whether the scene of present frame changes.
As, the number of the pixel of each colourity in two said histograms is subtracted each other, obtain the difference of the pixel of each colourity; With the absolute value addition of said difference, obtain two said histogrammic differences again; When said difference during, judge that then variation has taken place the scene of present frame greater than predetermined threshold value.
As shown in Figure 2, be an idiographic flow sketch map of the method for video image processing in the embodiment of the invention.The more detailed concrete description of this flow process said method.
201, obtain the breviary frame data (like yuv format) of frame of video.
Video as needs being detected video scene compresses, and becomes the video of 80*60 such as the video compression with 640*480, and follow-up the frame of video of analyzing 80*60 gets final product.Like this, as long as the ratio of appropriateness control compression, improve treatment effeciency under just can the be constant situation at the histogram of the follow-up generation of basic maintenance.
202, remove brightness and disturb, the colourity correlated components of calculating breviary frame data (as, comprehensive U, V data), and compute histograms.
That is, the Y in yuv data promptly representes brightness, removes Y, an analysis-by-synthesis U, V data.
Like the histogram of Fig. 3 and Fig. 4, abscissa can but be not limited to comprehensive U, the chromatic value of V data, ordinate are the number of the pixel of the corresponding screen in video playback zone, figure acceptance of the bid where there is light is in the number of the pixel of certain colourity.
Need to prove that like Fig. 3, shown in 4, transverse axis is the x axle among the figure, it can also represent U, the gray scale of V data; The longitudinal axis is the y axle, and it representes the accumulative total number of corresponding gray scale.So-called gray scale is exactly branch ranks such as gray value, and such as in this example, the gray value scope is 0-255; Divide 16 gray scales, i.e. the scope of x axle from 0 to 15 (grade), the maximum of x axle is 15; So 256/16=16; Be that per 16 gray values are a tonal gradation: 0 ~ 15 gray value is first gray scale, and 16 ~ 31 gray values are second gray scale, by that analogy.In general, the scope of chromatic value (being gray value in this example) can be made as 0-255.
203, more adjacent thumbnail frame histogram (can remove camera lens and move interference) detects the place that occurrence scene changes in all videos.
Like Fig. 3 is the corresponding histogram of a last frame of video, and Fig. 4 is the corresponding histogram of current video frame, and these two histograms are compared analysis, obtains this two histogrammic differences.Such as elder generation the number of the pixel of each the colourity segmentation (fragment size influences the width of each vertical bar in the histogram) in two histograms is subtracted each other; Obtain the difference of the pixel of each colourity segmentation, obtain the absolute value of difference, the absolute value with each difference carries out addition then; Obtain this two histogrammic differences; Whether judge this difference then greater than preset threshold value, if greater than, show that present frame is different with the scene of previous frame representative; The scene variation has promptly taken place; Mark according to present frame time corresponding point that the scene variation has taken place this time point in the whole video reproduction time, thereby be partitioned into each video scene, such as being partitioned into scene 1, scene 2 or the like.
Also be not limited to the video of yuv format in the embodiment of the invention.Can also be extended formatting, as be rgb format that then chrominance information S can adopt following formula to obtain during rgb format: S=(MAX (R, G, B)-MIN (R, G, B))/MAX (R, G, B).R, G, B represent the tristimulus values of pixel in the rgb format respectively in the formula.
Describe and can know through the foregoing description, only generate histogram according to the chrominance information in the frame of video, whether the scene that detects video variation has taken place, and can remove brightness and change the interference that brings, and improves the accuracy of Video Detection.
Simultaneously, the object of detection is the breviary frame of adjacent video frames, and the data input when having reduced scene detection can improve the efficient of detection; And, since detect to as if adjacent video frames can remove camera lens and move the interference that brings.Scene detection in the past all is comparison scene fragment first frame and present frame, and fragment first frame and present frame difference are bigger when camera lens moves like this, causes judging by accident because of moving; And in embodiments of the present invention, the former frame and the present frame of present frame compared, because they are adjacent, this two frame data difference is little, also is more or less the same even exist to move.
Such as taking office scenarios; Possibly be here slowly to clap toward the inside from door; Camera lens slowly moves to the inside from door like this, and this scene fragment first frame is the image of door so, and the picture of taking the inside to the back is diverse with first frame basically; If employing first method; This two two field picture has no common ground so, but current scene follows the scene of last frame of video continuous in time also to be in the Same Scene, and this way of prior art can be different scenes with the current scene erroneous judgement.
As shown in Figure 5, be a concrete sketch map of forming of the video image processing device in the embodiment of the invention.This device 5 comprises: frame acquisition module 50, be used to obtain the breviary frame of adjacent video frames, and wherein, said adjacent video frames is meant the former frame and the present frame of the present frame in the video; Colourity acquisition module 52 is used to obtain the chromatic component of the breviary frame of said present frame and said former frame; Histogram acquisition module 54 is used to obtain the chromatic component histogram of breviary frame of chromatic component histogram and said former frame of the breviary frame of said present frame; Correlation acquisition module 56 is used to obtain two said histogrammic correlations; Judge module 58 is used for judging according to said correlation whether the scene of present frame changes.
Wherein, said breviary frame is a yuv data, and said chromatic component comprises U, V data component.Abscissa in the said chromatic component histogram is represented the chromatic component of breviary frame, and ordinate is represented the number of the pixel of the screen that the video playback zone is corresponding.
Said correlation acquisition module 56 also is used for; The number of the pixel of each colourity in two said histograms is subtracted each other; Obtain the difference of the pixel of each colourity, with the absolute value addition of said difference, obtain two said histogrammic differences again.Said judge module 58 also is used for, and when said difference during greater than predetermined threshold value, judges that variation has taken place the scene of present frame.
Consistent among each function among this device embodiment and term and the said method embodiment, the histogram of describing among Fig. 3 and Fig. 4 also is applicable to this device embodiment, does not do here and gives unnecessary details.
Describe and can know through the foregoing description, only generate histogram according to the chrominance information in the frame of video, whether the scene that detects video variation has taken place, and can remove brightness and change the interference that brings, and improves the accuracy of Video Detection.
Simultaneously, the object of detection is the breviary frame of adjacent video frames, and the data input when having reduced scene detection can improve the efficient of detection; And, since detect to as if adjacent video frames can remove camera lens and move the interference that brings.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method; Be to instruct relevant hardware to accomplish through computer program; Described program can be stored in the computer read/write memory medium; This program can comprise the flow process like the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
Above disclosedly be merely a kind of preferred embodiment of the present invention, can not limit the present invention's interest field certainly with this, the equivalent variations of therefore doing according to claim of the present invention still belongs to the scope that the present invention is contained.