[ITK Community] VideoFileReader: segmentation fault

Matteo Pozza matteo.pozza at studenti.unipd.it
Fri Mar 7 08:57:57 EST 2014


Hi Matt,

I tried to run GNU Debugger and this is the result

Program received signal SIGSEGV, Segmentation fault.
0x0000000000471002 in
itk::VideoFileReader<itk::VideoStream<itk::Image<itk::RGBPixel<unsigned
char>, 2u> > >::InitializeVideoIO (this=0xe18800)
    at /usr/local/include/ITK-4.5/itkVideoFileReader.hxx:252
252      m_VideoIO->SetFileName(m_FileName.c_str());

It seems that there is some problems with the file path but I'm pretty sure
that the path I pass is correct. I've tried also to fix a path with a
std::string and then convert it with c_str() function passing it to
reader->SetFileName() but the error is the same.

Thank you for your help.



2014-03-07 10:11 GMT+01:00 Matt McCormick <matt.mccormick at kitware.com>:

> Hi Matteo,
>
> What is the file:line number?
>
> Thanks,
> Matt
>
> PS.  Please keep replies on the list so all can benefit.
>
>
> On Fri, Mar 7, 2014 at 4:07 AM, Matteo Pozza <
> matteo.pozza at studenti.unipd.it> wrote:
>
>> Dear Matt,
>>
>> I'm trying to use QtDebugger: it says that the segmentation fault is in
>> the nested call
>>
>> itk::VideoFileReader<itk::VideoStream<itk::Image<itk::RGBPixel<unsigned
>> char>, 2u> > >::InitializeVideoIO()
>>
>>
>> 2014-03-07 9:46 GMT+01:00 Matteo Pozza <matteo.pozza at studenti.unipd.it>:
>>
>> Dear Matt,
>>>
>>> I'll try immediately what you suggest to me, but perhaps I'm using this
>>> class with the wrong purpose: can I read with this class .mpeg and .avi
>>> video formats? Otherwise, which formats can I read with this class?
>>>
>>> Thanks
>>>
>>>
>>> 2014-03-07 9:40 GMT+01:00 Matt McCormick <matt.mccormick at kitware.com>:
>>>
>>> Hi Matteo,
>>>>
>>>> What does the stack trace show?  Try setting CMAKE_BUILD_TYPE to Debug,
>>>> and use GDB or a GDB-based graphical debugger.
>>>>
>>>> Thanks,
>>>> Matt
>>>>
>>>>
>>>> On Fri, Mar 7, 2014 at 3:14 AM, Matteo Pozza <
>>>> matteo.pozza at studenti.unipd.it> wrote:
>>>>
>>>>> Dear Matt,
>>>>> thank you for answering!
>>>>> I already call the reader->Update() in a try/catch block like this one
>>>>>
>>>>> // code above
>>>>> try {
>>>>>         cout << "Control point 1\n";
>>>>>         reader->Update();
>>>>>         cout << "Control point 2\n";
>>>>>     }
>>>>>     catch (itk::ExceptionObject & e) {
>>>>>         std::cerr << "exception in file reader " << std::endl;
>>>>>         std::cerr << e << std::endl;
>>>>>         return EXIT_FAILURE;
>>>>>     }
>>>>> // code below
>>>>>
>>>>> The output of this piece of code is:
>>>>>
>>>>> Control point 1
>>>>> Segmentation fault (core dumped)
>>>>>
>>>>>
>>>>> 2014-03-07 8:34 GMT+01:00 Matt McCormick <matt.mccormick at kitware.com>:
>>>>>
>>>>> Hi Matteo,
>>>>>>
>>>>>> Is the reader->Update() call in a try-catch block [1]?
>>>>>>
>>>>>> Thanks,
>>>>>> Matt
>>>>>>
>>>>>> [1]
>>>>>> http://itk.org/ITKExamples/src/Core/Common/TryCatchException/Documentation.html
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 6, 2014 at 12:06 PM, Matteo Pozza <
>>>>>> matteo.pozza at studenti.unipd.it> wrote:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Community mailing list
>>>>>>> Community at itk.org
>>>>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140307/5a58a4dd/attachment-0002.html>


More information about the Community mailing list