[vtkusers] continuous saving of image frames

Tim Soper tim_d_soper at yahoo.com
Tue Apr 17 13:12:45 EDT 2007


Dominik, 
   Thanks, I may give this a try. I did have one other small question. For saving images, I added code directly to my video source code so that I save a frame every time I grab a frame. I was thinking it may be better to create a new class altogether to do that, say a vtkVideoSourceRecorder. Then I might asynchronously save frames in a separate thread. I tried to do something like this:
===========================================
source = vtkVideoSource::New( );    \\video source
sourceRecorder = vtkVideoSourceRecorder::New( );  \\recorder to write files periodically
sourceRecorder->SetInput( source->GetOutput( ) );  \\connect the two
 
source->SetFrameRate( 30 );    \\set display rate
sourceRecorder->SetSaveRate( 10 ); \\set frame-save rate

source->Record( );
=============================================

When I tried this, the display rate was very slow, and frames were often corrupted. It appears that by having the Source Recorder try to access image data asynchronously, it can grab frames halfway through a frame grab or causes some other potential problem. I'm curious if this is a good approach or if handling a continuously changing output asynchronously is a bad idea. If I can do this, is there a way to pause the pipeline or halt it while I access the output data? 



Tim Soper

Research Assistant
University of Washington
Department of Bioengineering 
Box 352142

----- Original Message ----
From: Dominik Szczerba <domi at vision.ee.ethz.ch>
To: vtkusers at vtk.org
Sent: Saturday, April 14, 2007 11:34:47 PM
Subject: Re: [vtkusers] continuous saving of image frames

I save the images to a ram disk.
Dominik

On Sunday 15 April 2007 01:14, Tim Soper wrote:
> Hi-
>    I've been writing a subclass for vtkVideoSource to grab frames in a
> custom application. I'm at the point where I would like to continuously
> save captured frames to individual files. While continuous display of video
> frames works nicely (30Hz+), saving the images using vtkPNGWriter or
> vtkBMPWriter (those are the two I tried) is drastically slowing my
> application. At most I can save 2-4 frames per second. To compare, I tried
> writing the bitmap data to files directly in a raw format using the c++
> command fwrite( ) and was able to save images easily at 10 fps. Is there a
> way to speed up the process using a vtkImageWriter subclass. Any help would
> be greatly appreciated.
>
> Tim Soper
>
> Research Assistant
> University of Washington
> Department of Bioengineering
> Box 352142
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-- 
Dominik Szczerba, PhD
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the vtkusers mailing list