[vtkusers] RGBA to gray in VTK
    David Doria 
    daviddoria+vtk at gmail.com
       
    Wed Jul 21 16:12:10 EDT 2010
    
    
  
On Wed, Jul 21, 2010 at 4:09 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> You need to be careful here.  There are two ways to convert images to greyscale:
>
>  vtkImageLuminance -> use luminance equation for properly weighting
> the R, G, and B
>
>  vtkImageMagnitude -> do a sum-of-squares computation
>
> These filters are meant for different things.  For RGB, you usually
> want to use luminance because in the RGB colorspace, G has slightly
> higher luminance than R, and both have much higher luminance than B.
>
> The vtkImageMagnitude filter is meant for use on vector images, not so
> much for RGB images.
>
> You can use vtkImageExtractComponents to extract the RGB components
> from an RGBA image:
> vtkImageExtractComponents::SetComponents(0, 1, 2);
>
>  David
Here are examples of what David G. said:
http://www.vtk.org/Wiki/VTK/Examples/Images/ImageLuminance
http://www.vtk.org/Wiki/VTK/Examples/Images/ExtractComponents
Thanks,
David
    
    
More information about the vtkusers
mailing list