[ITK Community] VideoFileReader: segmentation fault

Matteo Pozza matteo.pozza at studenti.unipd.it
Thu Mar 6 12:06:20 EST 2014


Hi everyone,
I'm trying to read a video with ITK: I want to get every single frame for
compute some features. I'm trying to use the code below

typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image< RGBPixelType, 2 > InputImageType;
typedef itk::VideoStream<
InputImageType> VideoStream;
typedef itk::VideoFileReader<VideoStream> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( name );
reader->Update();
VideoStream::Pointer video = reader->GetOutput();
VideoStream::FramePointer singleFrame = video->GetFrame(0);

but reader->Update() gives me segmentation fault runtime error. I've
already checked that the filename passed to the reader is consistent, so
the error is really strange.
I've looked for some examples but I've haven't found so much, so is likely
that my code is somewhere wrong: I've also found that before instantiating
the reader is appropriate to put

itk::ObjectFactoryBase::RegisterFactory( itk::FileListVideoIOFactory::New()
);

but also with this line of code the error is the same at the same point.

I ask you to guide me to a correct use of these classes or to give me some
advices about this problem: anyway, thank you for the attention!

Matteo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140306/023d2b5e/attachment-0002.html>


More information about the Community mailing list