Re: How to get a particular frame from a video?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: How to get a particular frame from a video?

rossagray
I'm having the same problem - cvSetCaptureProperty works fine in
Windows but there seems to be a bug in the Linux version. I hope
somebody manages to fix this soon.

Ross


--- In [hidden email], Aldo Camargo <acamargofb@...> wrote:
>
> Hi Ismail and Group:
>
> I did test my code in Windows with Visual C++ 2005 and works, but
when I use linux Ubuntu is not working.

> Does somebody of OpenCV group knows what is happening?
>
> Have a nice day,
>
> Aldo
>
>
>
>
> ----- Original Message ----
> From: ismail rusli <ismail_indonesia@...>
> To: Aldo Camargo <acamargofb@...>
> Sent: Friday, September 19, 2008 1:18:42 AM
> Subject: Re: [OpenCV] How to get a particular frame from a video?
>
>
> I use Windows and Microsoft VC++ 2005.
>
>
>
> ----- Original Message ----
> From: Aldo Camargo <acamargofb@...>
> To: ismail_indonesia@...
> Sent: Friday, September 19, 2008 11:23:17 AM
> Subject: Re: [OpenCV] How to get a particular frame from a video?
>
>
> Hi Ismail:
>
> That's is strange because it always show me the first frame. Did you
use windows or linux?

>
> Thanks a lot in advance,
>
> Aldo0
>
>
>
> ----- Original Message ----
> From: ismail rusli <ismail_indonesia@...>
> To: [hidden email]
> Sent: Thursday, September 18, 2008 10:45:26 AM
> Subject: Re: [OpenCV] How to get a particular frame from a video?
>
>
> Aldo, i don't know what is going wrong. I compiled myself your code
and it's alright: i get the frame you wanted. In this code, you try to
get one frame, right? And i get that frame shown in my window.
>
> By the way, I just wanna make sure because in your first letter, you
said you want to play a video from a certain frame to the end. To do
this, you've got to make an infinite loop.

>
> ----- Original Message ----
> From: Aldo Camargo <acamargofb@yahoo. com>
> To: OpenCV@yahoogroups. com
> Sent: Thursday, September 18, 2008 10:23:58 PM
> Subject: Re: [OpenCV] How to get a particular frame from a video?
>
> Hi Ismail, Group:
>
> Here you have a simple code which I am testing to get the frame 4000
and always show me the first one:

> What's is the problem?
>
> #include <stdio.h>
> #include <cv.h>
> #include <highgui.h>
> #include <math.h>
>
> int main(int argc, char *argv[])
> {
>
> int             numBytes;
> int             i, videoStream;
> int             frameFinished;
> int j;
> float framerate;
> double StartFrame;
> int time;
>
> static IplImage *framet = NULL, *framet_1C = NULL;
>
> if (argc != 2)
> {
> fprintf(stderr, "usage: %s input.avi\n" , argv[0]);
> return -1;
> }
>
> CvCapture *input_video = cvCaptureFromAVI( argv[1] );
> if (input_video == NULL)
> {
> fprintf(stderr, "Error: Can't open video.\n");
> return -1;
> }
>
> cvQueryFrame( input_video );
>
> CvSize frame_size;
> frame_size.height =
> (int) cvGetCapturePropert y( input_video, CV_CAP_PROP_ FRAME_HEIGHT );
> frame_size.width =
> (int) cvGetCapturePropert y( input_video, CV_CAP_PROP_ FRAME_WIDTH );
> framerate = (float)cvGetCapture Property( input_video, CV_CAP_PROP_
FPS );

>
> cvSetCapturePropert y( input_video, CV_CAP_PROP_ POS_FRAMES, 4000 );
>
> framet = cvQueryFrame( input_video );
>
> framet_1C = cvCreateImage( cvSize(framet- >width,framet- >height), 8,1);
>
> framet_1C = cvCloneImage( framet);
>
> cvNamedWindow( "test", CV_WINDOW_AUTOSIZE) ;
> cvShowImage( "test", framet_1C);
> cvWaitKey(0) ;
> cvReleaseImage( &framet_1C);
>
> return 0;
>
> }
>
> ----- Original Message ----
> From: ismail rusli <ismail_indonesia@ yahoo.com>
> To: OpenCV@yahoogroups. com
> Sent: Wednesday, September 17, 2008 2:21:49 PM
> Subject: Re: [OpenCV] How to get a particular frame from a video?
>
> I am sure it is another part of the code that makes it goes wrong
Aldo. I use the same function and got the result i wanted.

>
> ----- Original Message ----
> From: Aldo Camargo <acamargofb@ yahoo. com>
> To: OpenCV@yahoogroups. com
> Sent: Wednesday, September 17, 2008 4:43:21 AM
> Subject: [OpenCV] How to get a particular frame from a video?
>
> Hi Group:
>
> I am trying to start reading a video from a particular frame (since
the frame which is in the 30 ms) til the end of the video, to do this
I am using the following code:

>
> cvSetCapturePropert y( input_video, CV_CAP_PROP_ POS_MSEC, 30. );
> frame = cvQueryFrame( input_video) ;
>
> The problem is that always starts reading since the beginning,
>
> Does somebody how to do it?
>
> Have a nice day,
>
> Aldo
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
>    
>
>
>      
>
> [Non-text portions of this message have been removed]
>