[vtkusers] RGBA to gray in VTK
Prathamesh Kulkarni
prathameshmkulkarni at gmail.com
Wed Jul 21 15:51:41 EDT 2010
Hello all,
I am trying to convert an image from RGBA to gray scale so that I can
compare it pixel by pixel with another gray scale image. Following is what I
did:
vtkSmartPointer<vtkImageMapToColors> gray_from_RGBA_map =
vtkSmartPointer<vtkImageMapToColors>::New();
grayd_from_RGB_map->SetInput(RGBA_image_data);
gray_from_RGB_map->SetOutputFormatToLuminance();
gray_from_RGB_map->Update();
int channels =
gray_from_RGBA_map->GetOutput()->GetNumberOfScalarComponents();
The variable "channels" is 4 irrespective of whether I include a
vtkImageMapToColors in the pipeline.
Am I doing anything wrong here? What is the best way to do this?
Any help will be highly appreciated.
Prathamesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100721/d19ece0b/attachment.htm>
More information about the vtkusers
mailing list