[vtk-developers] RGBA to RGB
Andreas Gamber
agamber at gmx.de
Wed Mar 14 18:05:04 EDT 2007
Hello everyone,
does anyone know a possibility to convert RGBA-vtkImageData to RGB-vtkImageData?
I have to connect an OpenGL-application with a VTK-client.
On OpenGL-side:
unsigned char pdata = new unsigned char[width*height*4];
glReadPixels(0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,pdata);
The pdata-array holds the pixel-data as RGBA.
The VTK-application-side:
vtkImageImport *imageImport = vtkImageImport::New();
imageImport->SetNumberOfScalarComponents(4);
imageImport->SetWholeExtent(0,width-1,0,height-1,0,0);
imageImport->SetDataExtentToWholeExtent();
imageImport->SetDataScalarTypeToUnsignedChar();
imageImport->SetImportVoidPointer(pdata);
imageImport->GetOutput() delivers RGBA-vtkImageData but the VTK-client is only able to handle RGB vtkImageData.
The client-application is supposed to work in real time, so a simple reorganisation of the data-array
is impossible because it takes to much time.
Does VTK provide a method to get rid of the Alpha-part?
Thanks,
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070314/bcb508d4/attachment.html>
More information about the vtk-developers
mailing list