[Insight-users] Help with Video Stream

Franck P. Vidal franck.p.vidal at gmail.com
Thu May 16 17:07:13 EDT 2013


Hello,

I have some code to read an AVI file.
Get the  method GetFrame of the VideoStream returns NULL.


-------------------------------------------------------------------------------------
   typedef unsigned char PixelType;
   typedef itk::Image<PixelType, 2> FrameType;
   typedef itk::VideoStream<FrameType> VideoType;

   typename itk::VideoFileReader<VideoType>::Pointer m_p_file_reader;
   typename VideoType::Pointer m_p_stream_data;
   typename FrameType::Pointer m_p_current_frame;

	…	…	…

   try
   {
	// Set the current frame to be the first frame
	m_current_frame = 0;

       // Load the IO factory for video files
       itk::ObjectFactoryBase::RegisterFactory(itk::OpenCVVideoIOFactory::New());

	// Create the file reader
       m_p_file_reader = itk::VideoFileReader<VideoType>::New();

       // Set the file name
       m_p_file_reader->SetFileName(aFileName);

       // Load the file
       m_p_file_reader->Update();
       m_p_file_reader->UpdateOutputInformation();
       m_p_stream_data = m_p_file_reader->GetOutput();

       m_p_current_frame = m_p_stream_data->GetFrame(m_current_frame);

	…	…	…
	

   }
   catch (std::exception& e)
   {
		std::cerr << "WARNING: " << e.what() << std::endl;
       return (false);
   }
-------------------------------------------------------------------------------------

Any idea why 'm_p_current_frame' is always NULL???

Cheers,



More information about the Insight-users mailing list