OpenCV Video Writer example source code (VideoWriter function)

This is video writer example source code.
This source code was used from video load & display.

//file load
 VideoCapture capture(".\\video.avi");
 Mat frame;

 //Set properties
 int askFileTypeBox=0; //-1 is show box of codec
 int Color = 1;
 Size S = Size( (int)capture.get(CV_CAP_PROP_FRAME_WIDTH), 

 //make output video file
 VideoWriter outVideo;".\\outVideo.avi", askFileTypeBox, capture.get(CV_CAP_PROP_FPS), S, Color);

 if( !capture.isOpened() )
  printf("AVI file can not open.\n");
 //create window
  //grab frame from file & throw to Mat
  capture >> frame;
  if(frame.empty() ) //Is video end?
  //processing example
  outVideo << frame;
  //display and delay
  imshow("w", frame);
  if(waitKey(10) > 0)


Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write