<div dir="ltr">I have the output of vtkImageBlend which is RGBA, and I need to convert this to grayscale. <br><br>Prathamesh<br><br><div class="gmail_quote">On Wed, Jul 21, 2010 at 3:00 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>></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></div><div class="h5">On Wed, Jul 21, 2010 at 3:51 PM, Prathamesh Kulkarni<br>
<<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@gmail.com</a>> wrote:<br>
> Hello all,<br>
><br>
> I am trying to convert an image from RGBA to gray scale so that I can<br>
> compare it pixel by pixel with another gray scale image. Following is what I<br>
> did:<br>
><br>
> vtkSmartPointer<vtkImageMapToColors> gray_from_RGBA_map =<br>
> vtkSmartPointer<vtkImageMapToColors>::New();<br>
> grayd_from_RGB_map->SetInput(RGBA_image_data);<br>
><br>
> gray_from_RGB_map->SetOutputFormatToLuminance();<br>
><br>
> gray_from_RGB_map->Update();<br>
><br>
> int channels =<br>
> gray_from_RGBA_map->GetOutput()->GetNumberOfScalarComponents();<br>
><br>
> The variable "channels" is 4 irrespective of whether I include a<br>
> vtkImageMapToColors in the pipeline.<br>
><br>
> Am I doing anything wrong here? What is the best way to do this?<br>
><br>
><br>
> Any help will be highly appreciated.<br>
><br>
><br>
> Prathamesh<br>
<br>
</div></div>Is the 'A' important? Or do you just want RGB to grey?<br>
<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Images/ConvertToGreyScale" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Images/ConvertToGreyScale</a><br>
<br>
Thanks,<br>
<font color="#888888"><br>
David<br>
</font></blockquote></div><br></div>