[vtkusers] VTK and OpenCV

Gabriel Santiago santiago.eletrica at gmail.com
Thu Jan 31 07:59:14 EST 2013


Dear all,

I am currently working with video processing and I need to determine the
frame rate that VTK is able to deal with with high resolution frames (1074
X 768). I already have a code using OpenCV and I am **very** new in VTK, so
I was trying to convert data from OpenCV to VTK and then display it using
VTK. I was following this thread:

http://vtk.1045678.n5.nabble.com/Display-OpenCV-Image-IplImage-in-VTK-td1248807.html

Here is the code:

void fromIpl2Vtk( IplImage* _src, vtkImageData* _dest )
{
    vtkImageImport *importer = vtkImageImport::New();
    if ( _dest )
    {
        importer->SetOutput( _dest );
    }
    importer->SetDataSpacing( 1, 1, 1 );
    importer->SetDataOrigin( 0, 0, 0 );
    importer->SetWholeExtent(   0, _src->width-1, 0, _src->height-1, 0,
_src->nChannels-1 );
    importer->SetDataExtentToWholeExtent();
    importer->SetDataScalarTypeToUnsignedChar();
    importer->SetNumberOfScalarComponents( _src->nChannels );
    importer->SetImportVoidPointer( _src->imageData );
    importer->Update();
}

But I found some errors in the line "importer->SetOutput( _dest );"
It complains that there is no function SetOutput for vtkImageData and then,
I tried to cast _dest to vtkDataObject like this:

importer->SetOutput( (vtkDataObject*)_dest );

Then I get some weird errors... One of them is "undefined reference to
vtkImageImport::New()".
Can someone, please, tell me what is wrong and what should I do?

Thanks in advance,

-- 
Gabriel Santiago

~"As long as I live so long do I learn"~
Ramakhrishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130131/947ca080/attachment.htm>


More information about the vtkusers mailing list