473,513 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ avi player - Open CV

1 New Member
Hello all,

I have been having some problems with using Open CV to play an avi file.

I am currently creating a eye input based system, where the mouse is replaced by an eye tracker. I am currently working on flat .csv files, and importing the coordinates then using those coordinates to do various tasks on the screen.

These coordinates have been recorded using a real eye tracker which creates two files, a .csv file of the coordinates of they eye movement and an avi file.

In essence what i am trying to achieve is to run the video in tandem with my self created code for the processing of the moues movements.

I have been advised to use Open CV for this, however i cannot seem to find a tutorial that shows me how to process an avi file and play it. This is very frustrating as i have seen many people comment on the ease of OpenCV yet i can't find any examples which aren't overly complicated! The file in question is named "test_00003.avi"

Leaving my rant behind :) I was hoping i may be able to open my question to a wider audience who may be able to help me in understanding how to create a simple, full screen avi player.

Kind Regards,
David


PS for additional information, I am currently using XP, Using Visual C++

Here is my code that i have attempted to make work :D

Expand|Select|Wrap|Line Numbers
  1.         CvCapture* capture = 0;
  2.     IplImage *frame, *frame_copy = 0;
  3.     static CvMemStorage* storage = cvCreateMemStorage(0);
  4.  
  5.     capture = cvCaptureFromAVI( "test_00003.avi" );
  6.  
  7.     cvNamedWindow( "Picture:", 1 );
  8.  
  9.     if( capture )
  10.     {
  11.         for(;;)
  12.         {
  13.             if( !cvGrabFrame( capture ))
  14.                 break;
  15.             frame = cvRetrieveFrame( capture );
  16.             if( !frame )
  17.                 break;
  18.             if( !frame_copy )
  19.                 frame_copy = cvCreateImage(
  20. cvSize(frame->width,frame->height),
  21.                                             IPL_DEPTH_8U,
  22. frame->nChannels );
  23.             if( frame->origin == IPL_ORIGIN_TL )
  24.                 cvCopy( frame, frame_copy, 0 );
  25.             else
  26.                 cvFlip( frame, frame_copy, 0 );
  27.  
  28.             cvShowImage("Picture:",frame_copy);
  29.  
  30.             // Varying this will vary the speed of the avi file
  31.             if( cvWaitKey( 20 ) >= 0 )
  32.                 break;
  33.         }
  34.  
  35.         cvReleaseImage( &frame_copy );
  36.         cvReleaseCapture( &capture );
  37.     }
  38.  
  39.     cvClearMemStorage( storage );   
  40.     cvDestroyWindow("Picture:");
  41. }
  42.  
Mar 10 '08 #1
0 2779

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2854
by: StefanT | last post by:
Hi, I have a web app and a I have a http handler for a file, when I have a web request for that file I insert a stream of bytes like this: public void ProcessRequest(System.Web.HttpContext...
2
9008
by: Vanga Sasidhar | last post by:
Already posted the same message but the date and time of my machine was set back. and it was listed under the old date. Thats why I am posting the same message again. Please accept this. ...
3
2894
by: alice | last post by:
I've been trying for a long time to figure this out, to have a page with several MP3 clips, and each one having a custom start and stop button next to them to play the track. I finally found a bit...
1
1769
by: syslight | last post by:
Hello, I need to open a media player window so that i have the controls, from a form ideally, the user would push a button and the player would open tot eh correct file. one other thing i...
1
3418
by: jamesdylangoldstein | last post by:
So I tried to do my father a favor and convert his advertisements to .flv and place them on his website. With Flash being $600, I found an open-source .flv player and configured it. So today he...
8
3648
exoskeleton
by: exoskeleton | last post by:
hi dear experts.. i know you are aware of video once clicked it will open in media player...but how about gif files? im developing a site in php...when gif files were clicked, it will open in media...
0
2653
by: artsohc | last post by:
Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while...
14
3625
by: chokies12 | last post by:
hello guys im new here..hope you can help make my first project in visual basic..i want to make a mp3 player in visual basic without using the WMP OCX.. i have started i downloaded a simple mp3...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.