[Insight-users] Help with Video Stream

Xiaoxiao Liu xiaoxiao.liu at kitware.com
Thu May 16 21:29:04 EDT 2013


Hi Franck,
Are u able to run all the video related tests in ITK? I would first make sure the ITK tests can pass on your system to rule out potential third party lib compatibility problems.




-

Sent from my iPad

On May 16, 2013, at 5:07 PM, "Franck P. Vidal" <franck.p.vidal at gmail.com> wrote:

> 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,
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list