[vtkusers] From vtkImageData to Iplimage (OpenCV)
alex Dowson
alexdowson at hotmail.com
Wed Sep 12 04:54:19 EDT 2012
Hi
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();
}
From: Jonathan Ruiz Peinado
Sent: Wednesday, September 12, 2012 2:14 PM
To: Ignacio Avellino
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] From vtkImageData to Iplimage (OpenCV)
I've worked with Ipl images before , if I'm not wrong the easiest way to do that is writing directly the scalars from vtkImage to Iplimage. sure I'm missing some details but the this is the idea. Sorry I can't help you more.
2012/9/12 Ignacio Avellino <ignacioavellino at gmail.com>
Hey all,
Has anyone figured out how to convert a vtkImageData to an image I can work
on OpenCv.
Basically I render something on the screen and I want to apply some OpenCV
algorithms to it.
Thanks in advance :)
Nacho
--
View this message in context: http://vtk.1045678.n5.nabble.com/From-vtkImageData-to-Iplimage-OpenCV-tp5716020.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
--------------------------------------------------------------------------------
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120912/ef6f1255/attachment.htm>
More information about the vtkusers
mailing list