Our Daily Bread

what I need to do ...

  • Continious learning -unlearn as necessary
  • Reach out to family & loves ones
  • Maintain fitness - strong core and clear IPPT
  • Pick up parenting skills
  • Save up and plan for renovation
  • Build passive business & investment income
  • Back up Data
  • Manage $ Cash flow
  • Learn sinan mori

Wednesday, June 15, 2011

OpenCV play video

During school days when i use OpenCV 1.1-2.0 for my final year project,
I had a hard time trying to capture video frame from .avi files.
I ran into codec issues having to convert my video dataset before i can capture
via OpenCV.

With the following code snippets below i am able to play .avi,.mpg and wmv files!


#include "highgui.h"
int main( int argc, char** argv ) {
  
    //Some validation can be included here for argv
    if( argc<2 ) return 1;
    CvCapture* capture = cvCreateFileCapture( argv[1] );
    if( !capture ) return 1;   
     /* get fps, needed to set the delay */
    int fps = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FPS );
    IplImage* frame;
    cvNamedWindow( "video", CV_WINDOW_AUTOSIZE );
    while(1) {
        frame = cvQueryFrame( capture );
        if( !frame ) break;
        cvShowImage( "video", frame );
        char c = cvWaitKey( 1000 / fps );
        if( c == 27 ) break;
    }
    cvReleaseCapture( &capture );
    cvDestroyWindow( "video" );
    return 0;
}

No comments:

Quotes

  • You are your thoughts.The thoughts in your head are what institute the laws of attraction. You think therefore you are. - Joe Vitalli, The Laws of Attraction
  • Don't react blatantly in Anger and become a Zero - Papati
  • Don't miss out in the learning values of problems by over-looking the root causes but starting at the occurences - Raj
  • You can do almost anything if you have a steady income. Little or much, what matters is that you can count it, month after month.Without the regular flow of funds, you will be constantly distracted from you goals - Norm & Bo
  • Time is greater than money, you can never really buy time. Don't let time slip away. - Raj
  • Ignore technology advancement and you will either be left behind or you have to fork out more - Raj
  • Without passion nothing happens in life but without compassion the wrong things happen - Jan Eliasson
  • The poorer you are the more you need to plan and act wisely. Any undesired outcome you have little resource to manoeuvre.
  • “Life changes when you least expect it to. The future is uncertain. So, seize this day, seize this moment, and make the most of it.”
  • To get to where you want to go in life you must start from where you are - Tan
  • Maturity does not come with age,it comes with the acceptance of responsibilities - Tan

ACM TechNews