[-blogs-] Video Summary video Enrichment

Source: Internet
Author: User

Video Summary Video Enrichment (i)

Video Digest, also known as video enrichment, is a simple generalization of video content, in an automatic or semi-automatic way, first through the analysis of moving objects, extracting moving objects, and then to the various targets of the motion trajectory analysis, the different targets are spliced into a common background scene , and combine them in some way. Video summarization plays an important role in video analysis and content-based video retrieval.

Video recording has a large amount of storage data, long storage time and other characteristics, through the video to find clues, to obtain evidence the traditional practice is to consume a lot of manpower, material and time, inefficient, so that the best time to solve the case. Therefore, in the video surveillance system, the original video is condensed, can be quickly browsed, lock the Search object, for the public security to speed up the case, improve the cases, major crimes the efficiency of the detection of the important guiding significance. (1)

For enterprise applications, video summarization and compression technology can enable enterprise managers to browse through the video in a short period of time. In the smartphone big line of the today, the use of Video Digest technology to monitor video processing, for mobile phone browsing, can save managers time, but also can save a lot of traffic. (2)

For me, there is a real need for surveillance video, and more importantly, this problem is a typical application of "image processing", which is worth researching and exploring. So we're doing research and implementation here.
I. Industry background and DIVISION The 97 CMU Informedia is for news videos, and MOCA is for movies. Israel Briefcam is an industry leader in surveillance video, as well as Videoq of Columbia University and Cuevideo of IBM. The domestic this piece is in the primary development state. The video summary can continue to be divided into 1, Picture Keyframe (extract some video); 2, cut the film (the machine to remove the still picture, only display a target screen); 3, Space change time (different time events show on the same screen). The 3rd is basically a video summary project that can be used for commercial use, similar to providing this effect. (Note that the two groups on the chart are people at different times.) Of course, the real video might be like this.
The background of my experiment here, first with 768 that AVI, and then with camp monitoring to do (opencv3.0 video 768x576.avi) Ii. Key technologies and algorithmic processes (i) Background modeling The base (Xiao) method for background modeling is "background modeling". The methods to be found include (1) Mean value method (2) Median method (3) Sliding average filter (4) Gaussian (5) Mixed Gaussian model (6) Codebook method. I'm here. ( 1) mean (3) sliding filter and (5) Mixed Gaussian method (1) mean Value method For 768*576.avi This video, is a more classic surveillance video, its characteristics are the main background scenery, lighting and so on is unchanged, the foreground characters walk back and forth. To deal with this problem, if you want to take the background out, the most straightforward way is to count the frame of a stage (such as 1 to 100), the image of each pixel in most of the time the color. If the average is calculated directly, the result is this
It should be said that this method has a certain effect, especially for the background is a vision, or change is not very large situation, the effect of treatment is better. But for the forward image shaking, the effect is not very ideal. Using the No. 0 frame and the average to find the Absdiff, you can see that the sign is clearly considered a foreground. This effect should not be too good. voidGobgmodeling (ConstChar* Videofilepath,Constintframe_num_used, mat* Bgmat, \
ConstintSize1,ConstintSize2,ConstintSIGMA1,ConstintSIGMA2) {
Statement
intFrame_no = 0;
Mat frame;
Mat tmp;
Videocapture pcapture (Videofilepath);//Select an AVI video for yourself
if(!pcapture.isopened ()) {
printf ("Unable to open video file for background modeling!\n");
return;
}
printf ("Background modeling...\n");
Read video frames by frame
Mat mattmp;
while(Frame_no < frame_num_used) {
pcapture>>frame;
Frame.convertto (FRAME,CV_32FC3);
Frame_no + = 1;
if(Frame_no = = 1) {
Initialization
TMP = Mat::zeros (FRAME.ROWS,FRAME.COLS,CV_32FC3);
Mattmp = Frame.clone ();
}
TMP = tmp + frame/frame_num_used;
*bgmat = tmp;
}
Bgmat->convertto (*BGMAT,CV_8UC3);
Mattmp.convertto (MATTMP,CV_8UC3);
Absdiff (MATTMP,*BGMAT,MATTMP);
printf ("Background Model has been achieved!\n");
}
(2) Sliding filter method /* Adds image to accumulator with WEIGHTS:ACC = acc* (1-alpha) + Image*alpha */ The principle of this method is not very clear to me, if the use of this method to calculate the background, the more in front of the picture, its weight is set greater. The same video results are as follows I think the result is worse than the mean. /**
* Background Modeling
*/
voidBgmodeling (ConstChar* Videofilepath,Constintframe_num_used, Iplimage * * bgimg, \
ConstintSize1,ConstintSize2,Const intSIGMA1,ConstintSIGMA2) {
Statement
Iplimage * frame = NULL;
Cvmat * Framemat = NULL;
Cvmat * Bgmat = NULL;
cvcapture* pcapture = NULL;
Iplimage * framtmp = NULL;
Cvmat * mattmp = NULL;
intFrame_no = 0;
Pcapture = Cvcapturefromfile (Videofilepath);//Select an AVI video for yourself
if(!pcapture) {
printf ("Unable to open video file for background modeling!\n");
return;
}
if(*bgimg! = NULL) {//non-empty need to first empty the memory pointed to by *bgimg
Cvreleaseimage (BGIMG);
}
printf ("Background modeling...\n");
Read video frames by frame
while(Frame_no < frame_num_used) {
frame = Cvqueryframe (pcapture);
Frame_no + = 1;
if(Frame_no = = 1) {
Initialization
Framtmp = Cvcreateimage (Cvsize (Frame->width, Frame->height), frame->depth, frame->nchannels);
Cvcopy (FRAME,FRAMTMP);
*bgimg = Cvcreateimage (Cvsize (Frame->width, Frame->height), frame->depth, frame->nchannels);
Cvcopy (frame, *bgimg);
Framemat = Cvcreatemat (Frame->height, Frame->width, CV_32FC3);
Bgmat = Cvcreatemat ((*bgimg)->height, (*bgimg)->width, CV_32FC3);
Cvconvert (frame, framemat);
Cvconvert (*bgimg, Bgmat);
Continue;
}
Video frame Iplimage Turn Cvmat
Cvconvert (frame, framemat);
Gaussian filtering first, to smooth the image
Cvsmooth (frame, frame, Cv_gaussian, Size1, Size2, SIGMA1, SIGMA2);
Sliding average update background (averaging)
Cvrunningavg (Framemat, Bgmat, (Double) 1/frame_num_used);

}

Cvconvert (Bgmat, *bgimg);
printf ("Background Model has been achieved!\n");
Freeing memory
Cvreleasecapture (&pcapture);
Cvreleasemat (&framemat);
Cvreleasemat (&bgmat);
}
(3) mixed Gaussian model int _tmain (int argc, _TCHAR * argv[]) {
Mat Bgmat;
Gobgmodeling ("1.avi", 100,&bgmat);
Cv::videocapture capture;
Capture.open ("1.avi");

if(!capture.isopened ())
{
std::cout<< "read video failure" <<std::endl;
return-1;
}
CV::BACKGROUNDSUBTRACTORMOG2 Mog;

Cv::mat foreground;
Cv::mat background;

Cv::mat frame;
LongFrameno = 0;
while(Capture.read (frame))
{
++frameno;
std::cout<<frameno<<std::endl;
Motion foreground detection, and update background
Mog (frame, foreground, 0.001);
Corrosion
Cv::erode (foreground, foreground, Cv::mat ());
Expansion
CV::d ilate (foreground, foreground, Cv::mat ());
Mog.getbackgroundimage (background); Returns the current background image
Cv::imshow ("video", foreground);
Cv::imshow ("background", background);
if(Cv::waitkey (+) > 0)
{
Break;
}
}
return0;
}
Although this is a direct use of the OPENCV provided by the Mog module, it should be said that the effect is quite good. However, it is necessary to clarify and understand the basic principles of Mog, and to sort out the realization of OPENCV, so that thoroughly understand knowledge is counted.



From for notes (Wiz)

[-blogs-] Video Summary video Enrichment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.