[vtkusers] Writing to vtkMPEGWriter directly from vtkImageData

Jefferson Thomas foramuyou at gmail.com
Tue May 27 01:43:52 EDT 2008


Hi,
I have a vtkImageData with size 200x30x1. The data changes with time
so I want to make an mpg out of it using the vtkMPEG2Writer.
I dont want to use the rendering, just a direct output of 2D frames to an MPG.
I do as follows:

vtkImageData* data = new vtkImageData::New();
... (filling the data table)

vtkMPEG2Writer *moviewriter = vtkMPEG2Writer::New();
	moviewriter->SetFileName("test.mpg");
	moviewriter->SetInput(data);
	moviewriter->Start();
	moviewriter->Write();
	moviewriter->End();

vtkJPEGWriter* jpgw=vtkJPEGWriter::New();
	jpgw->SetInput(data);
	jpgw->SetFileName("test.jpg");
	jpgw->Write();

The output "test.jpg" is very nice but the output "test.mpg" file is
ugly, grey and full of lines.
I've been trying it with different grid size (always x,y being a
multiple of 4 in order not to get the
http://www.vtk.org/pipermail/vtkusers/2006-July/086334.html errors)
and with different data but the result is always the same. MPG is ugly
and JPG is nice.
Is there anything Im doing wrong with MPEG output here ?
Thank you for any help,
Thomas



More information about the vtkusers mailing list