<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">&lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.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></div><div class="h5">On Wed, Jul 21, 2010 at 3:51 PM, Prathamesh Kulkarni<br>
&lt;<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@gmail.com</a>&gt; wrote:<br>
&gt; Hello all,<br>
&gt;<br>
&gt; I am trying to convert an image from RGBA to gray scale so that I can<br>
&gt; compare it pixel by pixel with another gray scale image. Following is what I<br>
&gt; did:<br>
&gt;<br>
&gt;     vtkSmartPointer&lt;vtkImageMapToColors&gt; gray_from_RGBA_map =<br>
&gt; vtkSmartPointer&lt;vtkImageMapToColors&gt;::New();<br>
&gt;     grayd_from_RGB_map-&gt;SetInput(RGBA_image_data);<br>
&gt;<br>
&gt;     gray_from_RGB_map-&gt;SetOutputFormatToLuminance();<br>
&gt;<br>
&gt;     gray_from_RGB_map-&gt;Update();<br>
&gt;<br>
&gt;     int channels =<br>
&gt; gray_from_RGBA_map-&gt;GetOutput()-&gt;GetNumberOfScalarComponents();<br>
&gt;<br>
&gt; The variable &quot;channels&quot; is 4 irrespective of whether I include a<br>
&gt; vtkImageMapToColors in the pipeline.<br>
&gt;<br>
&gt; Am I doing anything wrong here? What is the best way to do this?<br>
&gt;<br>
&gt;<br>
&gt; Any help will be highly appreciated.<br>
&gt;<br>
&gt;<br>
&gt; Prathamesh<br>
<br>
</div></div>Is the &#39;A&#39; 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>