I have also been trying to interface both Iplimage and vtkimagedata. Here is what I did<br><br>void fromIpl2Vtk( IplImage* _src, vtkImageData* _dest )<br>{<br>    vtkImageImport *importer = vtkImageImport::New();<br>    if ( _dest )<br>
    {<br>        importer-&gt;SetOutput( _dest );<br>    }<br>    importer-&gt;SetDataSpacing( 1, 1, 1 );<br>    importer-&gt;SetDataOrigin( 0, 0, 0 );<br>    importer-&gt;SetWholeExtent(   0, _src-&gt;width-1, 0, _src-&gt;height-1, 0, _src-&gt;nChannels-1 );<br>
    importer-&gt;SetDataExtentToWholeExtent();<br>    importer-&gt;SetDataScalarTypeToUnsignedChar();<br>    importer-&gt;SetNumberOfScalarComponents( _src-&gt;nChannels );<br>    importer-&gt;SetImportVoidPointer( _src-&gt;imageData );<br>
    importer-&gt;Update();<br>}<br><br>This works, but somehow vtk only recognizes the first channel  that is blue, which is the first channel of IplImage (BGR...BGR...) ... I was wondering if anyone had any suggestions to fix this.<br>
<br>thanks.<br>
<br><br><div class="gmail_quote">On Tue, May 4, 2010 at 3:02 PM, Samunda Perera <span dir="ltr">&lt;<a href="mailto:samunda_n@yahoo.com">samunda_n@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>Dear all,<br><br>I have a pointer to a image stored in memory (example void* frame or similar data type obtained from opencv) .<br>
How to display this 2D image data as a image in VTK window?<br><br>Thanks &amp; Regards,<br>Samu<br></div>
</div><br>







      </div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>